How to make this CMD For SWAT??
#1

hi everyone how to make this Commands Only FOR SWAT? Please Help me Guyz

Код:
dcmd_spike(playerid,params[])
{
	#pragma unused params
	new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
    GetPlayerPos(playerid, plocx, plocy, plocz);
    GetPlayerFacingAngle(playerid,ploca);
    CreateSpike(plocx,plocy,plocz,ploca);
	SendClientMessage(playerid, -1, "/rspike to Remove This");
    return 1;
}
dcmd_rspike(playerid,params[])
{
	#pragma unused params
	for(new i = 0; i < sizeof(SpikeInfo); i++)
  	{
  	    if(IsPlayerInRangeOfPoint(playerid, 2.0, SpikeInfo[i][sX], SpikeInfo[i][sY], SpikeInfo[i][sZ]))
        {
  	        if(SpikeInfo[i][sCreated] == 1)
            {
                SpikeInfo[i][sCreated]=0;
                SpikeInfo[i][sX]=0.0;
                SpikeInfo[i][sY]=0.0;
                SpikeInfo[i][sZ]=0.0;
                DestroyObject(SpikeInfo[i][sObject]);
                return 1;
  	        }
  	    }
  	}
    return 1;
}
dcmd_rallspikes(playerid,params[])
{
    #pragma unused playerid
	#pragma unused params
	for(new i = 0; i < sizeof(SpikeInfo); i++)
  	{
  	    if(SpikeInfo[i][sCreated] == 1)
  	    {
  	        SpikeInfo[i][sCreated]=0;
            SpikeInfo[i][sX]=0.0;
            SpikeInfo[i][sY]=0.0;
            SpikeInfo[i][sZ]=0.0;
            DestroyObject(SpikeInfo[i][sObject]);
  	    }
	}
    return 1;
}
This is the Commands so now how to make it For SWAT Only ? [ SWAT Skin : 285 ]
So can you help me?
Reply
#2

Could check for it by class or something like
Код:
if(GetPlayerSkin(playerid) != 285) return false;
Checking by skin
Reply
#3

You probably have something like pInfo[playerid][playerclass] (contains value of player class), use it to check.
Reply
#4

When I replace it Like this I got an Error Man

Код:
error 076: syntax error in the expression, or invalid function call
PHP код:
dcmd_spike(playerid,params[])
{
    
#pragma unused params
    
if(GetPlayerSkin != 285) return false;
    new 
Float:plocx,Float:plocy,Float:plocz,Float:ploca;
    
GetPlayerPos(playeridplocxplocyplocz);
    
GetPlayerFacingAngle(playerid,ploca);
    
CreateSpike(plocx,plocy,plocz,ploca);
    
SendClientMessage(playerid, -1"/rspike to Remove This");
    return 
1;

I do this
Reply
#5

Код:
dcmd_spike(playerid,params[])
{
    #pragma unused params
    if(GetPlayerSkin(playerid) != 285) return false;//This would show something like SERVER: Invalid Command
    new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
    GetPlayerPos(playerid, plocx, plocy, plocz);
    GetPlayerFacingAngle(playerid,ploca);
    CreateSpike(plocx,plocy,plocz,ploca);
    SendClientMessage(playerid, -1, "/rspike to Remove This");
    return 1;
}
My bad.
Reply
#6

Quote:

if(GetPlayerSkin != 285) return false;

Change it to.


Quote:

if(GetPlayerSkin(playerid) != 285) return false;

Reply
#7

Thank you its work but I need to do if player no swat Sent to him a message

How to add This if player are not SWAT? Give him this message
Код:
SendClientMessage(playerid, -1, "This Command available for SWAT Members only");
Reply
#8

Код:
if(GetPlayerSkin(playerid) != 285) return SendClientMessage(playerid, -1, "This Command available for SWAT Members only");
Read up On:
https://sampwiki.blast.hk/wiki/GetPlayerSkin
https://sampwiki.blast.hk/wiki/Control_Structures

For further stuffs like this.
Reply
#9

Quote:
Originally Posted by ISmokezU
Посмотреть сообщение
Код:
if(GetPlayerSkin(playerid) != 285) return SendClientMessage(playerid, -1, "This Command available for SWAT Members only");
Read up On:
https://sampwiki.blast.hk/wiki/GetPlayerSkin
https://sampwiki.blast.hk/wiki/Control_Structures

For further stuffs like this.
Thank you its worked Rep
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)