Help With CMD
#1

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;
  }
Reply
#2

Copy n Paste much>? where did you get it from
Reply
#3

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
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)