SA-MP Forums Archive
Radio System not working - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Radio System not working (/showthread.php?tid=301483)



Radio System not working - Gooday - 04.12.2011

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#define COLOR_GOLD 0xFFD700FF
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("FC:RP Bv1.0");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

CMD:r(playerid,params[])
{
    //police Radio
    if(GetPlayerSkin(playerid) == 285  || GetPlayerSkin(playerid) == 282 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 288 || 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,"((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) == 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) SendClientMessage(i,-1,msg); // same as above for skins
    }
    return 1;
}

CMD:er(playerid,params[])
{
    if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 282 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 288 ||GetPlayerSkin(playerid) == 278  || GetPlayerSkin(playerid) == 275 || GetPlayerSkin(playerid) == 279 || GetPlayerSkin(playerid) == 277 || GetPlayerSkin(playerid) == 274 || GetPlayerSkin(playerid) == 276) //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) SendClientMessage(i,-1,msg); // same as above for skins
    }
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])

{
    if(strcmp(cmdtext, "/chief186", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 275);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCFD Chief.");
        return 1;
    }
    if(strcmp(cmdtext, "/dchief1861", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 279);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCFD Deputy Chief.");
        return 1;
    }
    if(strcmp(cmdtext, "/fire1211", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 278);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCFD Fireman.");
        return 1;
    }
    if(strcmp(cmdtext, "/fire1212", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 277);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCFD Fireman.");
        return 1;
    }
    if(strcmp(cmdtext, "/fire1213", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 278);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCFD Fireman.");
        return 1;
    }
    if(strcmp(cmdtext, "/fire1214", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 277);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCFD Fireman.");
        return 1;
    }
    if(strcmp(cmdtext, "/med18612", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 274);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as Paramedic.");
        return 1;
    }
    if(strcmp(cmdtext, "/med18613", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 276);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as Paramedic");
        return 1;
    }
    if(strcmp(cmdtext, "/capt186", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 282);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCSD Capitan.");
        return 1;
    }
    if(strcmp(cmdtext, "/off1861", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 283);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCSD Officer.");
        return 1;
    }
    if(strcmp(cmdtext, "/off1862", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 288);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCSD Officer.");
        return 1;
    }
    if(strcmp(cmdtext, "/off1863", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 282);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCSD Officer.");
        return 1;
    }
    if(strcmp(cmdtext, "/off1864", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 288);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCSD Officer.");
        return 1;
    }
    if(strcmp(cmdtext, "/sher186", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 282);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCSD Sheriff.");
        return 1;
    }
    if(strcmp(cmdtext, "/dsher1861", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 283);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCSD Deputy Sheriff.");
        return 1;
   }
    if(strcmp(cmdtext, "/tow183867", true) == 0) {
        // Set the player's skin to ID 277, which is a fireman.
        SetPlayerSkin(playerid, 50);
        SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as Tow-Truck Driver.");
    }
    return 1;
 }


public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
Please help, +rep!

Quote:

C:\Documents and Settings\Luca\Desktop\BaseScript\filterscripts\job p.pwn(363) : warning 203: symbol is never used: "er"
C:\Documents and Settings\Luca\Desktop\BaseScript\filterscripts\job p.pwn(363) : warning 203: symbol is never used: "r"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Warnings.

ig not working :O


Re: Radio System not working - Thresholdold - 04.12.2011

Have you tried putting /r and /er under OnPlayerCommandText or OnPlayerSpawn?? putting it under OnPlayerConnect won't do much at all, because players haven't been given a skin when they connect. Only once they spawn.


Re: Radio System not working - [MG]Dimi - 04.12.2011

Quote:
Originally Posted by Threshold
Посмотреть сообщение
Have you tried putting /r and /er under OnPlayerCommandText or OnPlayerSpawn?? putting it under OnPlayerConnect won't do much at all, because players haven't been given a skin when they connect. Only once they spawn.
Check a bit more. It isn't under any callback. When you use ZCMD OnPlayerCommandText isn't called at all and his commands aren't under OnPlayerConnect.
@Gooday What does it say when you type /r or /er ?

EDIT: Also wrong forum section. You should post this into Scripting Discussion.