cmdtext, playerid
#1

How do I make that I wrote /ggg [playerid], and Playerid used SetPlayerSpecialAction

For example:

/ggg 5
and
The player with the id 5 started SetPlayerSpecialAction
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerCommandText
https://sampwiki.blast.hk/wiki/SetPlayerSpecialAction

It's all at the Wiki.
Reply
#3

pawn Код:
if(!strcmp(cmdtext,"/ggg",true))
{
  new cmd[128];
  cmd=strtok(cmdtext,idx);
  if(!strlen(cmd)) return SendClientMessage(playerid,color,"USAGE: /ggg [number]");
  SetPlayerSpecialAction(playerid,strval(cmd));
  return 1;
}
Should work.
Reply
#4

or:

pawn Код:
dcmd_ggg(playerid, params[])
{
new id;
if (sscanf(params, "d", id)) SendClientMessage(playerid,color,"USAGE: /ggg [number]");
else SetPlayerSpecialAction(playerid,id);
return 1;
}
You'll need the DCMD define and SSCANF stock for this to work. They can both be found here
Reply
#5

One thing to add to MenaceX and Weirdosport's - you could have added a check to see if the ID is an invalid ID?
Reply
#6

Gotta let him do some of it himself, this aint' the script request thread.
Reply
#7

He could make a stock, though this would take some time to check all valid/invalid animations.
Reply
#8

Sorry for my bluntness
One example
pawn Код:
if (strcmp(cmd, "/ggg,true) == 0)
{
SetPlayerSpecialAction(playerid, 68);
return 1;
}
I need that I wrote "/ggg [playerid]"
and the player (playerid) has fulfilled the function command

and check whether there ID in the game

Help me please, I very need..


Reply
#9

Quote:
Originally Posted by kruts
Sorry for my bluntness
One example
pawn Код:
if (strcmp(cmd, "/ggg,true) == 0)
{
SetPlayerSpecialAction(playerid, 68);
return 1;
}
I need that I wrote "/ggg [playerid]"
and the player (playerid) has fulfilled the function command

and check whether there ID in the game

Help me please, I very need..


pawn Код:
if (strcmp(cmdtext, "/ggg,true) == 0)
{
if(cmdtext[5] == 0) {
SendClientMessage(playerid, RED, "
Fill something in?");
}
if(IsPlayerConnected(cmdtext[5]) {
SetPlayerSpecialAction(cmdtext[5], 68);
}
else { SendClientMessage(playerid, RED, "
Offline"); }
return 1;
}
Reply
#10

Whilst i was typing this, Pandabeer1337 responded before me. I might as well finish off what i was doing. Use whatever one you want.
pawn Код:
if(!strcmp(cmdtext, "/ggg", true, 4))
    {
        if(!strlen(cmdtext[4])) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /ggg [playerid]");
        new otherid = strval(cmdtext[5]);
        if(!IsPlayerConnected(otherid)) return SendClientMessage(playerid, 0xFF0000AA, "That player isnt connected");
        new string[128];
        new adminname[MAX_PLAYER_NAME], otherguysname[MAX_PLAYER_NAME];
        GetPlayerName(otherid, otherguysname, sizeof(otherguysname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        format(string,STR,">> Hi %s , %s has made you piss :D", otherguysname, adminname);
        SendClientMessage(playerid, 0xFFFFFF00, string);
        SetPlayerSpecialAction(otherid, 68);
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)