PDA

View Full Version : How to make this CMD For SWAT??


Thanks
15/12/2016, 01:06 PM
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?

ISmokezU
15/12/2016, 01:36 PM
Could check for it by class or something like
if(GetPlayerSkin(playerid) != 285) return false;
Checking by skin

iLearner
15/12/2016, 01:40 PM
You probably have something like pInfo[playerid][playerclass] (contains value of player class), use it to check.

Thanks
15/12/2016, 01:44 PM
When I replace it Like this I got an Error Man

error 076: syntax error in the expression, or invalid function call

dcmd_spike(playerid,params[])
{
#pragma unused params
if(GetPlayerSkin != 285) return false;
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;
} I do this

ISmokezU
15/12/2016, 01:47 PM
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.

iLearner
15/12/2016, 01:47 PM
if(GetPlayerSkin != 285) return false;

Change it to.


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

Thanks
15/12/2016, 01:54 PM
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");

ISmokezU
15/12/2016, 02:04 PM
if(GetPlayerSkin(playerid) != 285) return SendClientMessage(playerid, -1, "This Command available for SWAT Members only");

Read up On:
https://wiki.sa-mp.com/wiki/GetPlayerSkin
http://wiki.sa-mp.com/wiki/Control_Structures

For further stuffs like this.

Thanks
15/12/2016, 02:08 PM
if(GetPlayerSkin(playerid) != 285) return SendClientMessage(playerid, -1, "This Command available for SWAT Members only");

Read up On:
https://wiki.sa-mp.com/wiki/GetPlayerSkin
http://wiki.sa-mp.com/wiki/Control_Structures

For further stuffs like this.

Thank you its worked :) Rep