SA-MP Forums Archive
Checking if player is in .... - 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)
+--- Thread: Checking if player is in .... (/showthread.php?tid=560568)



Checking if player is in .... - Lukasz56 - 29.01.2015

Why does this script give tasers to everyone , i'm trying that faction id 1 member could use it .

Код:
cmd(tazer, playerid, params[])
{
	new string[28+MAX_PLAYER_NAME];
	if(Tazer[playerid] == 0)
	{
        if(PlayerInfo[playerid][pFaction] == 1)
		{
		SendClientMessage(playerid, -1, "You cannot use this command.");
		}
		GivePlayerWeapon(playerid, 23, 9999);
		format(string, sizeof(string),"%s has unholstered his tazer.", RemoveUnderScore(playerid));
		ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
		Tazer[playerid] = 1;
	}
	else
	{
		SetPlayerAmmo(playerid, 23, 0);
		format(string, sizeof(string),"%s has holstered his tazer.", RemoveUnderScore(playerid));
		Tazer[playerid] = 0;
		ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
	}
	return 1;
}



Re: Checking if player is in .... - nezo2001 - 29.01.2015

PHP код:
cmd(tazerplayeridparams[])
{
    new 
string[28+MAX_PLAYER_NAME];
    if(
Tazer[playerid] == 0)
    {
        if(
PlayerInfo[playerid][pFaction] == 1) return SendClientMessage(playerid, -1"You cannot use this command.");

        
GivePlayerWeapon(playerid239999);
        
format(stringsizeof(string),"%s has unholstered his tazer."RemoveUnderScore(playerid));
        
ProxDetector(30.0playeridstringPURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
        
Tazer[playerid] = 1;
    }
    else
    {
        
SetPlayerAmmo(playerid230);
        
format(stringsizeof(string),"%s has holstered his tazer."RemoveUnderScore(playerid));
        
Tazer[playerid] = 0;
        
ProxDetector(30.0playeridstringPURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
    }
    return 
1;




Re: Checking if player is in .... - Lukasz56 - 29.01.2015

Quote:
Originally Posted by nezo2001
Посмотреть сообщение
PHP код:
cmd(tazerplayeridparams[])
{
    new 
string[28+MAX_PLAYER_NAME];
    if(
Tazer[playerid] == 0)
    {
        if(
PlayerInfo[playerid][pFaction] == 1) return SendClientMessage(playerid, -1"You cannot use this command.");
        
GivePlayerWeapon(playerid239999);
        
format(stringsizeof(string),"%s has unholstered his tazer."RemoveUnderScore(playerid));
        
ProxDetector(30.0playeridstringPURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
        
Tazer[playerid] = 1;
    }
    else
    {
        
SetPlayerAmmo(playerid230);
        
format(stringsizeof(string),"%s has holstered his tazer."RemoveUnderScore(playerid));
        
Tazer[playerid] = 0;
        
ProxDetector(30.0playeridstringPURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
    }
    return 
1;

still gives everyone ...


Re: Checking if player is in .... - nezo2001 - 29.01.2015

lol sorry
PHP код:
cmd(tazerplayeridparams[]) 

    new 
string[28+MAX_PLAYER_NAME]; 
        if(
PlayerInfo[playerid][pFaction] != 1) return SendClientMessage(playerid, -1"You cannot use this command."); 
    if(
Tazer[playerid] == 0
    { 
        
GivePlayerWeapon(playerid239999); 
        
format(stringsizeof(string),"%s has unholstered his tazer."RemoveUnderScore(playerid)); 
        
ProxDetector(30.0playeridstringPURPLE,PURPLE,PURPLE,PURPLE,PURPLE); 
        
Tazer[playerid] = 1
    } 
    else 
    { 
        
SetPlayerAmmo(playerid230); 
        
format(stringsizeof(string),"%s has holstered his tazer."RemoveUnderScore(playerid)); 
        
Tazer[playerid] = 0
        
ProxDetector(30.0playeridstringPURPLE,PURPLE,PURPLE,PURPLE,PURPLE); 
    } 
    return 
1




Re: Checking if player is in .... - ATGOggy - 29.01.2015

You mean, it gives a silenced pistol to everyone?


Re: Checking if player is in .... - JaydenJason - 29.01.2015

Код:
 cmd(tazer, playerid, params[])
{
	new string[28+MAX_PLAYER_NAME];
        if(PlayerInfo[playerid][pFaction] == 1) return SendClientMessage(playerid, -1, "You cannot use this command.");
	if(Tazer[playerid] == 0)
	{
		GivePlayerWeapon(playerid, 23, 9999);
		format(string, sizeof(string),"%s has unholstered his tazer.", RemoveUnderScore(playerid));
		ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
		Tazer[playerid] = 1;
	}
	else
	{
		SetPlayerAmmo(playerid, 23, 0);
		format(string, sizeof(string),"%s has holstered his tazer.", RemoveUnderScore(playerid));
		Tazer[playerid] = 0;
		ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
	}
	return 1;
}
This;ll do it I hope


Re: Checking if player is in .... - Lukasz56 - 29.01.2015

Quote:
Originally Posted by nezo2001
Посмотреть сообщение
lol sorry
PHP код:
cmd(tazerplayeridparams[]) 

    new 
string[28+MAX_PLAYER_NAME]; 
        if(
PlayerInfo[playerid][pFaction] != 1) return SendClientMessage(playerid, -1"You cannot use this command."); 
    if(
Tazer[playerid] == 0
    { 
        
GivePlayerWeapon(playerid239999); 
        
format(stringsizeof(string),"%s has unholstered his tazer."RemoveUnderScore(playerid)); 
        
ProxDetector(30.0playeridstringPURPLE,PURPLE,PURPLE,PURPLE,PURPLE); 
        
Tazer[playerid] = 1
    } 
    else 
    { 
        
SetPlayerAmmo(playerid230); 
        
format(stringsizeof(string),"%s has holstered his tazer."RemoveUnderScore(playerid)); 
        
Tazer[playerid] = 0
        
ProxDetector(30.0playeridstringPURPLE,PURPLE,PURPLE,PURPLE,PURPLE); 
    } 
    return 
1

works +rep