Creating a Slap command & >>> more...
#1

Hello, once again i'm creating my admin system.
i'm assign to make /slap command yeah i know how
but how can i make player position set to higher position just like luxadmin "/slap" command.

and not only that.

How can if the playerid i put in the /slap command is higher administrator?

Thanks - L0zaix
Reply
#2

Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(givenid, x, y, z);
SetPlayerPos(givenid, x, y, z+5);
Reply
#3

Quote:
Originally Posted by king_hual
Посмотреть сообщение
Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(givenid, x, y, z);
SetPlayerPos(givenid, x, y, z+5);
One question how to check if the playerid i put in /slap command is a higher administrator

and Thanks. gonna test it
Reply
#4

there is one problem when i try slap my self i teleport to NPC Jorge (actually i have 5 npc)
i don't know why. here is the code this is tested. this code has warning and not done yet.

pawn Код:
CMD:slap(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    new string[128],
        pname[MAX_PLAYER_NAME],
        victimname[MAX_PLAYER_NAME],
        victimid,
        reason[30];
    GetPlayerPos(victimid, x, y, z);
    GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerName(victimid, victimname, sizeof(victimname));
    if(PlayerInfo[playerid][Admin] > 3)
    {
       if(sscanf(params, "us[30]", victimid, reason)) return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /slap <playerid/name> <reason>");
       if(IsPlayerNPC(victimid)) return SendClientMessage(playerid, COLOR_RED, "You cannot slap NPC Bots!");
       if(victimid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invalid-Playerid!");
       SetPlayerPos(victimid, x, y, z+5);
    }
    else return SendClientMessage(playerid, COLOR_RED, "You must be Administrator Level 3 or higher to use this command!");
    return 1;
}
how to prevent it?
Reply
#5

someone?
Reply
#6

Use sccanf before getting pos
Reply
#7

what do you mean?
Reply
#8

Place the getpos and stuff BELOW the if(!sscanf. Part
Reply
#9

thanks it work! Topic Solved!
Reply
#10

I hope u understand ur mistake, any new thing is setted to 0 unless defined else, sscanf defines it to the players id
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)