Sorry my noobish. - 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: Sorry my noobish. (
/showthread.php?tid=96227)
Sorry my noobish. -
Hot - 06.09.2009
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/maps", cmdtext, true))
{
if(HasUsedMaps[playerid] == 1)
{
HasUsedMaps[playerid] = 1;
TextDrawShowForPlayer(playerid, Maps);
SendClientMessage(playerid, 0xFFFFFF, "* To close this box, type '/maps' again.");
return 1;
}
else TextDrawHideForPlayer(playerid, Maps); HasUsedMaps[playerid] = 0;
}
return 0;
}
Код:
SERVER: Unkwnown Command.
What's wrong?
Re: Sorry my noobish. -
CJ101 - 06.09.2009
[quote=Hot ]
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/maps", cmdtext, true))
{
if(HasUsedMaps[playerid] == 1)
{
HasUsedMaps[playerid] = 1;
TextDrawShowForPlayer(playerid, Maps);
SendClientMessage(playerid, 0xFFFFFF, "* To close this box, type '/maps' again.");
return 1;
}
else TextDrawHideForPlayer(playerid, Maps); HasUsedMaps[playerid] = 0;
return 1;
}
return 0;
}
Re: Sorry my noobish. -
Hot - 06.09.2009
Now nothing happens :S
Re: Sorry my noobish. -
RaFsTar - 06.09.2009
pawn Код:
if(!strcmp("/maps", cmdtext, true))
To
pawn Код:
if(strcmp("/maps", cmdtext, true) == 0)
Re: Sorry my noobish. -
[eLg]Timmy - 06.09.2009
Quote:
Originally Posted by RaFsTar
pawn Код:
if(!strcmp("/maps", cmdtext, true))
To
pawn Код:
if(strcmp("/maps", cmdtext, true) == 0)
|
!strcmp() and strcmp() == 0 is the same...
Re: Sorry my noobish. -
HuRRiCaNe - 06.09.2009
have u tried
pawn Код:
if(strcmp(cmdtext,"/maps", true) == 0)
Re: Sorry my noobish. -
RaFsTar - 06.09.2009
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
Should have return 1;
e.g:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
//STUFF
return 1;
}
Re: Sorry my noobish. -
[eLg]Timmy - 06.09.2009
Quote:
Originally Posted by RaFsTar
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
Should have return 1;
e.g:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) { //STUFF
return 1; }
|
There is no difference...return 1 just shows the player command has been found. If he write /help and there is no command called /help it will still show that the command has been found.
That's why he should return 0; because it will send "SERVER: Unknown command." if there is no such command...