how to make a radio system?
#1

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....
Reply
#2

PHP Code:
// 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,playeridparams);
        for(new 
i=0;i<MAX_PLAYERS;i++)
        if(
GetPlayerSkin(i) == 285SendClientMessage(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,playeridparams);
        for(new 
i=0;i<MAX_PLAYERS;i++)
        if(
GetPlayerSkin(i) == 278SendClientMessage(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,playeridparams);
        for(new 
i=0;i<MAX_PLAYERS;i++)
        if(
GetPlayerSkin(i) == 285SendClientMessage(i,-1,msg); // same as above for skins
    
}
    return 
1;

UNTESTED. Post if you have any questions
Reply
#3

where i have to add this code? ps thanks!
Reply
#4

Under any command already in the script.
Reply
#5

No. Under all Callbacks. This is ZCMD example. You have to #include <zcmd>
Reply
#6

yes but under what line? onplayertext?
Reply
#7

No. Outside all callbacks
Ex/
pawn Code:
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;
}
Reply
#8

please can u post a xample?
Reply
#9

I posted it up there (Ex. means Example)

Quote:
Originally Posted by [MG]Dimi
View Post
No. Outside all callbacks
Ex/
pawn Code:
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;
}
Reply
#10

Quote:

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
Quote:

C:\Documents and Settings\Luca\Desktop\BaseScript\gamemodes\base.pw n(9 : 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 © 1997-2006, ITB CompuPhase


9 Errors.

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)