"If player is spawned" i need help.. [I give 1+ rep.]
#1

I'm wondering how to limit certain commands to players that aren't spawned or spawned.

So i have this script that i have made that is like Mafia VS Cops so, i want when you're spawned you can't use the command /cop to join the cop team if you're already on it or on the other team. Here is the code for cops & mafia.

CMD:cop(playerid, params[])
{
SetSpawnInfo( playerid, 0, 285, 2047.1105,-2625.3525,13, 26, 29, 28, 150, 0, 0,0 );
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"You are now a cop, don't arrest anyone before you have a reason to.");
SpawnPlayer(playerid);
return 1;
}


CMD:mafia(playerid, params[])
{
SetSpawnInfo( playerid, 0, 111, 1706.6038,-1875.1898,13, 26, 31, 28, 150, 0, 0,0 );
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"");
SendClientMessage(playerid,COLOR_WHITE,"You have choosen to join the Mafias, rememeber not to expose your guns to the cops.");
SpawnPlayer(playerid);
return 1;
}

I will give you 1+ repurtation if you help me, thanks!
Reply
#2

dude this is not the way to do it!!
Reply
#3

Quote:
Originally Posted by InfinityGamerX
Посмотреть сообщение
dude this is not the way to do it!!
How is the way to do it? Thanks!
Reply
#4

you can put certain command for skins or we can create a Team System

for skin
pawn Код:
if(GetPlayerSkin(playerid)) == 222
{
kick(playerid)
}
or tutorial for team setup

https://sampforum.blast.hk/showthread.php?tid=331290
Reply
#5

pawn Код:
stock IsPlayerSpawned(playerid)
{
    switch(GetPlayerState(playerid))
    {
        case 0,7,9: return false;
    }
    return true;
}
Reply
#6

C:\Users\Martin\Desktop\samp\gamemodes\martin.pwn( 135) : error 017: undefined symbol "IsPlayerSpawned"
Reply
#7

Here I made these two commands for you, if you want it to be that right when they choose they're skin they become and cop or mafia just tell me.

pawn Код:
CMD:cop(playerid, params[])
{
    if(GetPlayerSkin(playerid) == 280)
    {
        SetSpawnInfo( playerid, 0, 285, 2047.1105,-2625.3525,13, 26, 29, 28, 150, 0, 0,0 );
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"You are now a cop, don't arrest anyone before you have a reason to.");
        SpawnPlayer(playerid);
    }
    else return SendClientMessage(playerid, COLOR_WHITE, "You're not in a cop skin!");
    return 1;
}

CMD:mafia(playerid, params[])
{
    if(GetPlayerSkin(playerid) == 0) //Insert your mafia skin here
    {
        SetSpawnInfo( playerid, 0, 111, 1706.6038,-1875.1898,13, 26, 31, 28, 150, 0, 0,0 );
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"");
        SendClientMessage(playerid,COLOR_WHITE,"You have choosen to join the Mafias, rememeber not to expose your guns to the cops.");
        SpawnPlayer(playerid);
    }
    else return SendClientMessage(playerid, COLOR_WHITE, "You're not in a mafia skin!");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)