Hallo
Ohne die new bekomme ich Fehler, wenn ich sie jedoch dazuschreibe, geht ingame der /f garnicht, da der Server den Command nicht kennt. Könntest du mir schnell helfen ?
new string[256];
new sstring[256];
new cmd[256];
new sendername[MAX_PLAYER_NAME];
new idx;
if(strcmp(cmdtext, "/f", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Hinweis: /f [Text]");
return true;
}
if (PlayerInfo[playerid][pTeam] != 0)
{
if(PlayerInfo[playerid][pMember] != 0)
{
format(string, sizeof(string), " Fraktion %s: %s. )) ", sendername, string);
SendFamilyMessage(PlayerInfo[playerid][pMember], COLOR_YELLOW, sstring);
return 1;
}
if(PlayerInfo[playerid][pLeader] != 0)
{
format(string, sizeof(string), " Fraktion (Leader) %s: %s. )) ", sendername, string);
SendFamilyMessage(PlayerInfo[playerid][pLeader], COLOR_YELLOW, sstring);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du bist in keiner Fraktion");
}
}
return true;
}
}
C:\Users\X\Desktop\dudalus124.pwn(2338) : warning 219: local variable "sendername" shadows a variable at a preceding level
C:\Users\X\Desktop\dudalus124.pwn(2332) : warning 204: symbol is assigned a value that is never used: "sendername"
C:\Users\X\Desktop\dudalus124.pwn(2331) : warning 204: symbol is assigned a value that is never used: "cmd"
C:\Users\X\Desktop\dudalus124.pwn(2331 -- 2380) : warning 209: function "JB_OnPlayerCommandText" should return a value
C:\Users\X\Desktop\dudalus124.pwn(9087) : warning 217: loose indentation
C:\Users\X\Desktop\dudalus124.pwn(9563) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
6 Warnings.
Funktioniert so nicht. Ich habe die nicht benötigten new`s mal drinnengelassen
MfG dUDALUS