Trouble with 2 commands - 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)
+--- Thread: Trouble with 2 commands (
/showthread.php?tid=326703)
Trouble with 2 commands -
BosteQ - 18.03.2012
Код:
C:\Documents and Settings\***\Desktop\ser\gamemodes\Test\pzwt.pwn(572) : error 017: undefined symbol "cmd"
C:\Documents and Settings\***\Desktop\ser\gamemodes\Test\pzwt.pwn(581) : error 017: undefined symbol "sendername"
C:\Documents and Settings\***\Desktop\ser\gamemodes\Test\pzwt.pwn(581) : error 017: undefined symbol "sendername"
C:\Documents and Settings\***\Desktop\ser\gamemodes\Test\pzwt.pwn(581) : error 029: invalid expression, assumed zero
C:\Documents and Settings\***\Desktop\ser\gamemodes\Test\.pwn(581) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
5 Errors.
Dodane Linijki:
Код:
//----------------------------------[Emote]-----------------------------------------------
if(strcmp(cmd, "/ja", true) == 0 || strcmp(cmd, "/me", true) == 0)
{
if(IsPlayerConnected(playerid))
{
/* if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " Nie jesteś zalogowany !");
return 1;
}*/
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, "Użyj: /ja [akcja]");
return 1;
}
format(string, sizeof(string), "* %s %s", sendername, result);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
printf("%s", string);
}
return 1;
}
//----------------------------------[Emote]-----------------------------------------------
if(strcmp(cmd, "/do", true) == 0)
{
if(IsPlayerConnected(playerid))
{
/*if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " Nie jesteś zalogowany !");
return 1;
}*/
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, "Użyj: /do [akcja]");
return 1;
}
format(string, sizeof(string), "* %s ((%s))", result, sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
printf("%s", string);
}
return 1;
}
Re: Trouble with 2 commands -
James Coral - 18.03.2012
pawn Код:
new sendername[MAX_PLAYER_NAME];
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
REP PLEASE
Re: Trouble with 2 commands -
BosteQ - 18.03.2012
Код:
494 if(strcmp(cmdtext, "/pm", true) == 0)
495 {
496 new dir[256],idx,giveplayerid;
603
Код:
format(string, sizeof(string), "* %s %s", sendername, result);
Код:
C:\Documents and Settings\BBD\Desktop\serwer\gamemodes\Test\pzwt.pwn(496) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Documents and Settings\BBD\Desktop\serwer\gamemodes\Test\pzwt.pwn(603) : error 017: undefined symbol "string"
C:\Documents and Settings\BBD\Desktop\serwer\gamemodes\Test\pzwt.pwn(603) : error 017: undefined symbol "string"
C:\Documents and Settings\BBD\Desktop\serwer\gamemodes\Test\pzwt.pwn(603) : error 029: invalid expression, assumed zero
C:\Documents and Settings\BBD\Desktop\serwer\gamemodes\Test\pzwt.pwn(603) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Re: Trouble with 2 commands -
James Coral - 18.03.2012
Try
pawn Код:
new string[128];//I dont know is that working
if thats dont work give me GM in Private Messages
Re: Trouble with 2 commands -
BosteQ - 18.03.2012
Gamemode Send