SA-MP Forums Archive
How to make this CMD For SWAT?? - 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: How to make this CMD For SWAT?? (/showthread.php?tid=624371)



How to make this CMD For SWAT?? - Thanks - 15.12.2016

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?



Re: How to make this CMD For SWAT?? - ISmokezU - 15.12.2016

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


Re: How to make this CMD For SWAT?? - iLearner - 15.12.2016

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


Re: How to make this CMD For SWAT?? - Thanks - 15.12.2016

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


Re: How to make this CMD For SWAT?? - ISmokezU - 15.12.2016

Код:
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.


Re: How to make this CMD For SWAT?? - iLearner - 15.12.2016

Quote:

if(GetPlayerSkin != 285) return false;

Change it to.


Quote:

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




Re: How to make this CMD For SWAT?? - Thanks - 15.12.2016

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");



Re: How to make this CMD For SWAT?? - ISmokezU - 15.12.2016

Код:
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.


Re: How to make this CMD For SWAT?? - Thanks - 15.12.2016

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