PDA

View Full Version : how to make a radio system?


Gooday
26/11/2011, 02:05 PM
Hoq i can make a command like /r (radio) for cops
and another one for FD and a both cops and firemans

BUT JUST FOR COP SKINS the 1 st the second JUST FD/EMS skin and the last PD FD EMS skins....

[MG]Dimi
26/11/2011, 02:29 PM
// Normal radio /r
CMD:r(playerid,params[])
{
//police Radio
if(GetPlayerSkin(playerid) == 285) //replace this with your Cop Skin. If you have more than use use it as if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 286...)
{
if(isnull(params)) return SendClientMessage(playerid,-1,"Usage: /r [text]");
new name[24],msg[128];
GetPlayerName(playerid,name,24);
format(msg,128,"Police Radio from %s(%d): %s",name,playerid, params);
for(new i=0;i<MAX_PLAYERS;i++)
if(GetPlayerSkin(i) == 285) SendClientMessage(i,-1,msg); // same as above for skins
}
//FF/EMS Radio
if(GetPlayerSkin(playerid) == 278) //replace this with your FF/EMS Skin. If you have more than use use it as if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 286...)
{
if(isnull(params)) return SendClientMessage(playerid,-1,"Usage: /r [text]");
new name[24],msg[128];
GetPlayerName(playerid,name,24);
format(msg,128,"FF/EMS Radio from %s(%d): %s",name,playerid, params);
for(new i=0;i<MAX_PLAYERS;i++)
if(GetPlayerSkin(i) == 278) SendClientMessage(i,-1,msg); // same as above for skins
}
return 1;
}

//Emergency Radio (FF/EMS/PD) /gr
CMD:er(playerid,params[])
{
if(GetPlayerSkin(playerid) == 285) //replace this with your Cop Skins+FF/EMS Skins. if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 286...)
{
if(isnull(params)) return SendClientMessage(playerid,-1,"Usage: /er [text]");
new name[24],msg[128];
GetPlayerName(playerid,name,24);
format(msg,128,"Emergency Radio from %s(%d): %s",name,playerid, params);
for(new i=0;i<MAX_PLAYERS;i++)
if(GetPlayerSkin(i) == 285) SendClientMessage(i,-1,msg); // same as above for skins
}
return 1;
}

UNTESTED. Post if you have any questions

Gooday
26/11/2011, 02:51 PM
where i have to add this code? ps thanks!

Supercop
26/11/2011, 02:55 PM
Under any command already in the script.

[MG]Dimi
26/11/2011, 02:58 PM
No. Under all Callbacks. This is ZCMD example. You have to #include <zcmd>

Gooday
26/11/2011, 02:59 PM
yes but under what line? onplayertext?

[MG]Dimi
26/11/2011, 03:02 PM
No. Outside all callbacks
Ex/ public OnPlayerConnect(playerid)
{
return 1;
}

CMD:er(playerid,params[])
{
if(GetPlayerSkin(playerid) == 285) //replace this with your Cop Skins+FF/EMS Skins. if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 286...)
{
if(isnull(params)) return SendClientMessage(playerid,-1,"Usage: /er [text]");
new name[24],msg[128];
GetPlayerName(playerid,name,24);
format(msg,128,"Emergency Radio from %s(%d): %s",name,playerid, params);
for(new i=0;i<MAX_PLAYERS;i++)
if(GetPlayerSkin(i) == 285) SendClientMessage(i,-1,msg); // same as above for skins
}
return 1;
}

public OnGameModeInit()
{
return 1;
}

Gooday
26/11/2011, 03:02 PM
please can u post a xample?

[MG]Dimi
26/11/2011, 03:07 PM
I posted it up there (Ex. means Example)

Dimi;1539240']No. Outside all callbacks
Ex/ public OnPlayerConnect(playerid)
{
return 1;
}

CMD:er(playerid,params[])
{
if(GetPlayerSkin(playerid) == 285) //replace this with your Cop Skins+FF/EMS Skins. if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 286...)
{
if(isnull(params)) return SendClientMessage(playerid,-1,"Usage: /er [text]");
new name[24],msg[128];
GetPlayerName(playerid,name,24);
format(msg,128,"Emergency Radio from %s(%d): %s",name,playerid, params);
for(new i=0;i<MAX_PLAYERS;i++)
if(GetPlayerSkin(i) == 285) SendClientMessage(i,-1,msg); // same as above for skins
}
return 1;
}

public OnGameModeInit()
{
return 1;
}

Gooday
26/11/2011, 03:14 PM
CMD:r(playerid,params[])
{
//police Radio
if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 288 || GetPlayerSkin(playerid) == 282) //replace this with your Cop Skin. If you have more than use use it as if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 286...)
{
if(isnull(params)) return SendClientMessage(playerid,-1,"Usage: /r [text]");
new name[24],msg[128];
GetPlayerName(playerid,name,24);
format(msg,128,"((BCSD Radio)) %s(%d): %s",name,playerid, params);
for(new i=0;i<MAX_PLAYERS;i++)
if(GetPlayerSkin(i) == 285) SendClientMessage(i,-1,msg); // same as above for skins
}
//FF/EMS Radio
if(GetPlayerSkin(playerid) == 278 || GetPlayerSkin(playerid) == 275 || GetPlayerSkin(playerid) == 279 || GetPlayerSkin(playerid) == 278 || GetPlayerSkin(playerid) == 277 || GetPlayerSkin(playerid) == 274 || GetPlayerSkin(playerid) == 276) //replace this with your FF/EMS Skin. If you have more than use use it as if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 286...)
{
if(isnull(params)) return SendClientMessage(playerid,-1,"Usage: /r [text]");
new name[24],msg[128];
GetPlayerName(playerid,name,24);
format(msg,128,"((BCFD Radio)) %s(%d): %s",name,playerid, params);
for(new i=0;i<MAX_PLAYERS;i++)
if(GetPlayerSkin(i) == 278 || GetPlayerSkin(playerid) == 275 || GetPlayerSkin(playerid) == 279 || GetPlayerSkin(playerid) == 278 || GetPlayerSkin(playerid) == 277 || GetPlayerSkin(playerid) == 274 || GetPlayerSkin(playerid) == 276) SendClientMessage(i,-1,msg); // same as above for skins
}
//Emergency Radio (FF/EMS/PD) /gr
CMD:er(playerid,params[])
{
if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 288 || GetPlayerSkin(playerid) == 282 == 278 || GetPlayerSkin(playerid) == 275 || GetPlayerSkin(playerid) == 279 || GetPlayerSkin(playerid) == 278 || GetPlayerSkin(playerid) == 277 || GetPlayerSkin(playerid) == 274 || GetPlayerSkin(playerid) == 276 || GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 288 || GetPlayerSkin(playerid) == 282) //replace this with your Cop Skins+FF/EMS Skins. if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 286...)
{
if(isnull(params)) return SendClientMessage(playerid,-1,"Usage: /er [text]");
new name[24],msg[128];
GetPlayerName(playerid,name,24);
format(msg,128,"((Emergency Radio))%s(%d): %s",name,playerid, params);
for(new i=0;i<MAX_PLAYERS;i++)
if(GetPlayerSkin(i) == 285 || GetPlayerSkin(playerid) == 275 || GetPlayerSkin(playerid) == 279 || GetPlayerSkin(playerid) == 278 || GetPlayerSkin(playerid) == 277 || GetPlayerSkin(playerid) == 274 || GetPlayerSkin(playerid) == 276)) SendClientMessage(i,-1,msg); // same as above for skins
}
return 1;
}


errors
C:\Documents and Settings\Luca\Desktop\BaseScript\gamemodes\base.pw n(98) : error 004: function "AutoWeather" is not implemented
C:\Documents and Settings\Luca\Desktop\BaseScript\gamemodes\base.pw n(99) : error 017: undefined symbol "LoadStaticVehiclesFromFile"
C:\Documents and Settings\Luca\Desktop\BaseScript\gamemodes\base.pw n(270) : error 017: undefined symbol "IsRolePlayName"
C:\Documents and Settings\Luca\Desktop\BaseScript\gamemodes\base.pw n(285) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Luca\Desktop\BaseScript\gamemodes\base.pw n(295) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Luca\Desktop\BaseScript\gamemodes\base.pw n(303) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Luca\Desktop\BaseScript\gamemodes\base.pw n(303) : error 017: undefined symbol "cmd_er"
C:\Documents and Settings\Luca\Desktop\BaseScript\gamemodes\base.pw n(303) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Luca\Desktop\BaseScript\gamemodes\base.pw n(303) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


9 Errors.