[HELP] Will this work? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Will this work? (
/showthread.php?tid=135384)
[HELP] Will this work? -
FreddeN - 20.03.2010
Hello, I have been experimenting with a TPM command, do you think this will work, if not, can oyu please help me to fix it?
Код:
if(strcmp("/tpm", cmd, true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[256];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GREY, " USAGE: /tpm [text]");
return 1;
}
format(string, sizeof(string), "TPM: %s: %s", sendername, result);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == gTeam[playerid])
SendClientMessage(playerid, PM_INCOMING_COLOR, string);
}
return 0;
}
return 1;
}
Thanks
Re: [HELP] Will this work? -
MadeMan - 20.03.2010
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == gTeam[playerid])
SendClientMessage(i, PM_INCOMING_COLOR, string);
}
}
Changed playerid to i and removed
return 0;