Help With CMD - 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 With CMD (
/showthread.php?tid=158659)
Help With CMD -
striker25 - 10.07.2010
Um idk whats wrong with this cmd
error 017: undefined symbol "ReturnUser"
error 017: undefined symbol "ReturnUser"
these 2 errors help me out please
pawn Код:
if(!strcmp(cmdtext,"/cuff",true))
{
if(gTeam[playerid] == COP || gTeam[playerid] == SWAT || gTeam[playerid] == ARMY || gTeam[playerid] == FBI)
{
tmp=strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /cuff playerid");
giveplayerid = ReturnUser(tmp);
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,COLOR_GREY,"Invalid player id.");
TogglePlayerControllable(giveplayerid,0);
GameTextForPlayer(giveplayerid, "~y~ You have been Cuffed!",2500,3);
}
return 1;
}
if(!strcmp(cmdtext,"/uncuff",true))
{
if(gTeam[playerid] == COP || gTeam[playerid] == SWAT || gTeam[playerid] == ARMY || gTeam[playerid] == FBI)
{
tmp=strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /uncuff playerid");
giveplayerid = ReturnUser(tmp);
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,COLOR_GREY,"Invalid player id.");
TogglePlayerControllable(giveplayerid,1);
GameTextForPlayer(giveplayerid, "~y~ You have been Uncuffed!",2500,3);
}
return 1;
}
Re: Help With CMD -
Kar - 10.07.2010
Copy n Paste much>? where did you get it from
Re: Help With CMD -
Adil - 10.07.2010
Paste this in your script.
pawn Код:
ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
new pos = 0;
while (text[pos] < 0x21) // Strip out leading spaces
{
if (text[pos] == 0) return INVALID_PLAYER_ID; // No passed text
pos++;
}
new userid = INVALID_PLAYER_ID;
if (IsNumeric(text[pos])) // Check whole passed string
{
// If they have a numeric name you have a problem (although names are checked on id failure)
userid = strval(text[pos]);
if (userid >=0 && userid < MAX_PLAYERS)
{
if(!IsPlayerConnected(userid))
{
/*if (playerid != INVALID_PLAYER_ID)
{
SendClientMessage(playerid, 0xFF0000AA, "User not connected");
}*/
userid = INVALID_PLAYER_ID;
}
else
{
return userid; // A player was found
}
}
/*else
{
if (playerid != INVALID_PLAYER_ID)
{
SendClientMessage(playerid, 0xFF0000AA, "Invalid user ID");
}
userid = INVALID_PLAYER_ID;
}
return userid;*/
// Removed for fallthrough code
}