SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   Actors problem (https://forum.sa-mp.com/showthread.php?t=587991)

AndreiWow 04/09/2015 04:46 PM

Actors problem
 
Code:

D:\server\samp\pawno\include\YSI\y_utils.inc(343) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\pawno\include\YSI\y_utils.inc(497) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\pawno\include\YSI\y_utils.inc(540) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\pawno\include\YSI\y_utils.inc(558) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\pawno\include\YSI\y_malloc.inc(216) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\pawno\include\sscanf.inc(3) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\gamemodes\abrffnew.pwn(131) : error 004: function "CreateActorInformation" is not implemented
D:\server\samp\gamemodes\abrffnew.pwn(170) : error 055: start of function body without function header
D:\server\samp\gamemodes\abrffnew.pwn(172) : error 017: undefined symbol "idx"
D:\server\samp\gamemodes\abrffnew.pwn(173) : error 021: symbol already defined: "format"
D:\server\samp\gamemodes\abrffnew.pwn(177) : error 010: invalid function or declaration
D:\server\samp\gamemodes\abrffnew.pwn(261) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\gamemodes\abrffnew.pwn(359) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\gamemodes\abrffnew.pwn(577) : warning 235: public function lacks forward declaration (symbol "OnPlayerFullyConnected")
D:\server\samp\gamemodes\abrffnew.pwn(592) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\gamemodes\abrffnew.pwn(605) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\gamemodes\abrffnew.pwn(659) : warning 217: loose indentation
D:\server\samp\gamemodes\abrffnew.pwn(659) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\gamemodes\abrffnew.pwn(690) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\gamemodes\abrffnew.pwn(714) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\gamemodes\abrffnew.pwn(758) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\gamemodes\abrffnew.pwn(777) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\gamemodes\abrffnew.pwn(811) : error 004: function "CreateActorInformation" is not implemented
D:\server\samp\gamemodes\abrffnew.pwn(821) : warning 219: local variable "string" shadows a variable at a preceding level
D:\server\samp\gamemodes\abrffnew.pwn(836) : warning 217: loose indentation
D:\server\samp\gamemodes\abrffnew.pwn(837) : warning 217: loose indentation
D:\server\samp\gamemodes\abrffnew.pwn(841) : error 017: undefined symbol "CreateDynamic3DTextLabel"
D:\server\samp\gamemodes\abrffnew.pwn(841) : warning 213: tag mismatch
D:\server\samp\gamemodes\abrffnew.pwn(843) : error 004: function "CreateActorInformation" is not implemented
D:\server\samp\gamemodes\abrffnew.pwn(863) : warning 217: loose indentation
D:\server\samp\gamemodes\abrffnew.pwn(865) : warning 217: loose indentation
D:\server\samp\gamemodes\abrffnew.pwn(865) : error 004: function "DestroyDynamic3DTextLabel" is not implemented
D:\server\samp\gamemodes\abrffnew.pwn(866) : error 004: function "CreateActorInformation" is not implemented
D:\server\samp\gamemodes\abrffnew.pwn(870) : warning 203: symbol is never used: "string"
Pawn compiler 3.2.3664                          Copyright (c) 1997-2006, ITB CompuPhase


10 Errors.

Code:

// ABR FUN FACTORY
// WTF
// LALA

#include <a_samp>
#include <YSI\y_ini>
#include <zcmd>
#include <sscanf>
#include <noclass>
#include <foreach>


#define PATH "/Users/%s.ini"

#define ACTOR_DATA  "Actors/%d"
#define MAX_ACTORSS  (200)

#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4

#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"

#define COLOR_CLIENT      (0xAAC4E5FF)
#define COLOR_WHITE      (0xFFFFFFFF)
#define COLOR_RED        (0xFF0000FF)
#define COLOR_CYAN        (0x33CCFFFF)
#define COLOR_LIGHTRED    (0xFF6347FF)
#define COLOR_LIGHTGREEN  (0x9ACD32FF)
#define COLOR_YELLOW      (0xFFFF00FF)
#define COLOR_GREY        (0xAFAFAFFF)
#define COLOR_HOSPITAL    (0xFF8282FF)
#define COLOR_PURPLE      (0xD0AEEBFF)
#define COLOR_LIGHTYELLOW (0xF5DEB3FF)
#define COLOR_DARKBLUE    (0x1394BFFF)
#define COLOR_ORANGE      (0xFFA500FF)
#define COLOR_LIME        (0x00FF00FF)
#define COLOR_GREEN      (0x33CC33FF)
#define COLOR_BLUE        (0x2641FEFF)
#define COLOR_FACTION    (0xBDF38BFF)
#define COLOR_RADIO      (0x8D8DFFFF)
#define COLOR_LIGHTBLUE  (0x007FFFFF)
#define COLOR_SERVER      (0xFFFF90FF) // 6688FF
#define COLOR_DEPARTMENT  (0xF0CC00FF)
#define COLOR_ADMINCHAT  (0x33EE33FF)
#define DEFAULT_COLOR    (0xFFFFFFFF)




new onlineplayers=0;
new DropLimit = 5;
new DeleteTime = 20;

#if defined FILTERSCRIPT

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

public OnFilterScriptExit()
{
        return 1;
}

#else

main()
{
        print("\n----------------------------------");
        print(" ABR Fun Factory by Missclick");
        print("----------------------------------\n");
}

#endif

new randomMessages[][] =  //here, we're creating the array with the name "randomMessages"
{
        "[INFO] We are hiring developers and testers currently.",
        "[INFO] You can use /cmds to see the commands and /stats to see your statistics.",
        "[INFO] This server is still in developtment so expect bugs."
};

enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
        pScore,
        pSkin,
        pAssistant,
        pFac,
        pLead,
        pAdminDuty
}
new PlayerInfo[MAX_PLAYERS][pInfo];

enum aInfo
{
        aSkin,
        aName[32],
        Text3D:aText,
        Float:aPosX,
        Float:aPosY,
        Float:aPosZ,
        Float:aPosA,
        aVW
}
new ActorInfo[MAX_ACTORSS][aInfo];

forward LoadActors();
public LoadActors()
{
        new Actor[64];
        for(new idx = 0; idx < sizeof(ActorInfo); idx++)
        {
                format(Actor, 64, ACTOR_DATA, idx);
                INI_ParseFile(Actor, "LoadActor_data", .bExtra = true, .extra = idx );
                if(ActorInfo[idx][aPosX] > 0.0)
                {
                        CreateActorInformation(idx);
                }
        }
        print("*Actors Loaded Correctly.");
        return 1;
}
forward SaveActors(idx);
public SaveActors(idx)
{
        new Actorfile[64];
        format(Actorfile, 64, ACTOR_DATA, idx);
        new INI:File = INI_Open(Actorfile);
        INI_SetTag(File,"Actor_Information");
        INI_WriteInt(File,"Skin", ActorInfo[idx][aSkin]);
        INI_WriteString(File,"Name", ActorInfo[idx][aName]);
        INI_WriteFloat(File,"PosX", ActorInfo[idx][aPosX]);
        INI_WriteFloat(File,"PosY", ActorInfo[idx][aPosY]);
        INI_WriteFloat(File,"PosZ", ActorInfo[idx][aPosZ]);
        INI_WriteFloat(File,"Angel", ActorInfo[idx][aPosA]);
        INI_WriteInt(File,"VirtualWorld", ActorInfo[idx][aVW]);
        INI_Close(File);
        return 1;
}

forward LoadActor_data(idx, name[], value[]);
public LoadActor_data(idx, name[], value[])
{
        INI_Int("Skin", ActorInfo[idx][aSkin]);
        INI_String("Name", ActorInfo[idx][aName], 32);
        INI_Float("PosX", ActorInfo[idx][aPosX]);
        INI_Float("PosY", ActorInfo[idx][aPosY]);
        INI_Float("PosZ", ActorInfo[idx][aPosZ]);
        INI_Float("Angel", ActorInfo[idx][aPosA]);
        INI_Int("VirtualWorld", ActorInfo[idx][aVW]);
        return 1;
}

forward CreateActorInformation(idx);
public CreateActorInformation(idx);
{
        new string[500];
        DestroyDynamic3DTextLabel(ActorInfo[idx][aText]);
        format(string, sizeof(string), "{00A2FF}%s (%d)", ActorInfo[idx][aName], idx);
        ActorInfo[idx][aText] = CreateDynamic3DTextLabel(string,-1, ActorInfo[idx][aPosX], ActorInfo[idx][aPosY], ActorInfo[idx][aPosZ]+1,6.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,1,0,0);
        CreateActor(ActorInfo[idx][aSkin], ActorInfo[idx][aPosX], ActorInfo[idx][aPosY], ActorInfo[idx][aPosZ], ActorInfo[idx][aPosA]);
        SetActorVirtualWorld(idx, ActorInfo[idx][aVW]);
        return 1;
}

forward RandomMessages();
public RandomMessages()
{
        new randomMsg = random(sizeof(randomMessages));
        SendClientMessageToAll(COLOR_GREEN, randomMessages[randomMsg]);
}

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
        INI_Int("Password",PlayerInfo[playerid][pPass]);
        INI_Int("Cash",PlayerInfo[playerid][pCash]);
        INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
        INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("Skin",PlayerInfo[playerid][pSkin]);
    INI_Int("Assistant",PlayerInfo[playerid][pAssistant]);
    INI_Int("Faction",PlayerInfo[playerid][pFac]);
    INI_Int("Leader",PlayerInfo[playerid][pLead]);
    INI_Int("AdminDuty",PlayerInfo[playerid][pAdminDuty]);
        return 1;
}

forward DropPlayerWeapons(playerid);
public DropPlayerWeapons(playerid)
{
    new playerweapons[13][2];
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid, x, y, z);

        for(new i=0; i<13; i++)
        {
            GetPlayerWeaponData(playerid, i, playerweapons[i][0], playerweapons[i][1]);
            new model = GetWeaponType(playerweapons[i][0]);
                new times = floatround(playerweapons[i][1]/10.0001);
            new Float:X = x + (random(3) - random(3));
            new Float:Y = y + (random(3) - random(3));
            if(playerweapons[i][1] != 0 && model != -1)
                {
                    if(times > DropLimit) times = DropLimit;
                    for(new a=0; a<times; a++)
                        {
                                new pickupid = CreatePickup(model, 3, X, Y, z);
                                SetTimerEx("DeletePickup", DeleteTime*1000, false, "d", pickupid);
                        }
                }
        }
        return 1;
}

forward DeletePickup(pickupid);
public DeletePickup(pickupid)
{
        DestroyPickup(pickupid);
        return 1;
}

GetWeaponType(weaponid) //explainin'
{
        switch(weaponid)
        {
            case 1: return 331; case 2: return 333; case 3: return 334; // this is to define the weapons
                case 4: return 335; case 5: return 336; case 6: return 337;
                case 7: return 338; case 8: return 339; case 9: return 341;
                case 10: return 321; case 11: return 322; case 12: return 323;
                case 13: return 324; case 14: return 325; case 15: return 326;
                case 16: return 342; case 17: return 343; case 18: return 344;
                case 22: return 346; case 23: return 347; case 24: return 348;
                case 25: return 349; case 26: return 350; case 27: return 351;
                case 28: return 352; case 29: return 353; case 30: return 355;
                case 31: return 356; case 32: return 372; case 33: return 357;
                case 34: return 358; case 35: return 359; case 36: return 360;
                case 37: return 361; case 38: return 362; case 39: return 363;
                case 41: return 365; case 42: return 366; case 46: return 371; //example, this case is the id 46 is the parachute, we will drop the parachute, that's if  you got one
        }
        return -1;
}

stock UserPath(playerid)
{
        new string[128],playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid,playername,sizeof(playername));
        format(string,sizeof(string),PATH,playername);
        return string;
}

/*Credits to Dracoblue*/
stock udb_hash(buf[]) {
        new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
      s1 = (s1 + buf[n]) % 65521;
      s2 = (s2 + s1)    % 65521;
    }
    return (s2 << 16) + s1;
}

public OnGameModeInit()
{
        SetGameModeText("FF|v0.0.1");
        AddPlayerClass(2, 2200.0459, 1285.3773, 10.8203, 93.1433, 0, 0, 0, 0, 0, 0);
        SetTimer("RandomMessages", 60000, true);
        return 1;
}

public OnGameModeExit()
{
        return 1;
}

/*public OnPlayerRequestClass(playerid, classid)
{
        SetPlayerPos(playerid, 2200.0459, 1285.3773, 10.8203);
        SetPlayerCameraPos(playerid, 2192.5767, 1285.3793, 10.8203);
        SetPlayerCameraLookAt(playerid, 2192.5767, 1285.3793, 10.8203);
        return 1;
}*/

public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
        {
                INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                  ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
        }
        else
        {
                ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
        }

    onlineplayers++;
        new str[128];
        format(str,sizeof(str),"SERVER STATUS: %i players are currently online.",onlineplayers);
        SendClientMessageToAll(0xED5F07FF,str);
        return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
        INI_SetTag(File,"data");
        INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
        INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
        INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
        INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
        INI_WriteInt(File,"Score",GetPlayerScore(playerid));
        INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
        INI_WriteInt(File,"Assistant",PlayerInfo[playerid][pAssistant]);
        INI_WriteInt(File,"Faction",PlayerInfo[playerid][pFac]);
        INI_WriteInt(File,"Leader",PlayerInfo[playerid][pLead]);
        INI_WriteInt(File,"AdminDuty",PlayerInfo[playerid][pAdminDuty]);
        INI_Close(File);
       
        onlineplayers--;
    new str[128];
    format(str,sizeof(str),"SERVER STATUS: %i players are currently online.",onlineplayers);
    SendClientMessageToAll(0xED5F07FF,str);
        return 1;
}

public OnPlayerSpawn(playerid)
{
        SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
        return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    DropPlayerWeapons(playerid);
   
    PlayerInfo[killerid][pKills]++;
        PlayerInfo[playerid][pDeaths]++;
        PlayerInfo[killerid][pScore]++;
       
        new targetplayer;
        new string[150], pName[MAX_PLAYER_NAME];
        GetPlayerName(targetplayer, pName, MAX_PLAYER_NAME);
        format(string, sizeof string, "-KILLCAM- "COL_WHITE"You have killed  %s and got +1 score and a kill.", pName);
          SendClientMessage(killerid, COLOR_RED, string);
        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("/ignorethis", cmdtext, true, 10) == 0)
        {
                // Do something here
                return 1;
        }
        return 0;
}

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[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",1000);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Skin",16);
                INI_WriteInt(File,"Assistant",0);
                INI_WriteInt(File,"Faction",0);
                INI_WriteInt(File,"Leader",0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 2200.0459, 1285.3773, 10.8203, 93.1433, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! You just registered. Relog to save your stats!","Ok","");
                        }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
                    SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
                    SetSpawnInfo(playerid, 0, 0, 2200.0459, 1285.3773, 10.8203, 93.1433, 0, 0, 0, 0, 0, 0);
                        SpawnPlayer(playerid);
                                        ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
        return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
        return 1;
}

public OnPlayerFullyConnected(playerid)
{
    SpawnPlayer(playerid);
}

CMD:setskin(playerid, params[])
{
  new targetplayer, skinid;
  if (PlayerInfo[playerid][pAdmin] <= 1) return SendClientMessage(playerid, 0xFF0000AA, "You have to be atleast Trial Admin.");
  //if(IsPlayerAdmin(playerid)) return 0;
  {
  if(sscanf(params, "ui", targetplayer, skinid)) return SendClientMessage(playerid, COLOR_WHITE, ""COL_LIGHTBLUE"<Usage> "COL_WHITE"/setskin [ID] [skinid]"); // this line is for; if you type /setskin, you will receive a message displayed with the "Usage" part.
  if(skinid < 0 || skinid > 311) return SendClientMessage(playerid, COLOR_RED, "<Error> "COL_WHITE"Available skinids 0 - 311");
  if(!IsPlayerConnected(targetplayer)) return SendClientMessage(playerid, COLOR_RED, "<Error> "COL_WHITE"Player is not connected!");
  //==-==
  new string[150], pName[MAX_PLAYER_NAME];
  SetPlayerSkin(targetplayer, skinid);
  format(string, sizeof string, "<ACCOUNT> Your skinid has been set by an admin to %i", skinid);
  SendClientMessage(targetplayer, COLOR_GREY, string);
  GetPlayerName(targetplayer, pName, MAX_PLAYER_NAME);
  format(string, sizeof string, "<AdmCmd> You have set %s's skinid to %i", pName, skinid);
  SendClientMessage(playerid, COLOR_GREY, string);
  }
  return 1;
}

CMD:stats(playerid, params[])
{
        new string[250], pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);

        format(string, sizeof(string), "--- %s Stats ---", pName);
        SendClientMessage(playerid, -1, string);
        format(string, sizeof(string), ""COL_WHITE"Cash: "COL_LIGHTBLUE"%d$ "COL_WHITE"| Admin Level: "COL_LIGHTBLUE"%d "COL_WHITE"| Kills: "COL_LIGHTBLUE"%d "COL_WHITE"| Deaths: "COL_LIGHTBLUE"%d "COL_WHITE"| Score: "COL_LIGHTBLUE"%d", PlayerInfo[playerid][pCash], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pScore]);
        SendClientMessage(playerid, -1, string);
        format(string, sizeof(string), ""COL_WHITE"Skin: "COL_LIGHTBLUE"%d "COL_WHITE"| Assistant Level: "COL_LIGHTBLUE"%d", PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pAssistant]);
        SendClientMessage(playerid, -1, string);
        return 1;
}

CMD:suicide(playerid, params[])
{
        SetPlayerHealth(playerid, 0);
        return 1;
}

CMD:testwep(playerid, params[])
{
        GivePlayerWeapon(playerid, 24, 50);
        GivePlayerWeapon(playerid, 3, 1);
        return 1;
}

CMD:goto(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] <= 2) return SendClientMessage(playerid, 0xFF0000AA, "You have to be atleast Trial Admin.");
    new ID;
    new pn[MAX_PLAYER_NAME];
    new an[MAX_PLAYER_NAME];
    new str[128];
    if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, ""COL_LIGHTBLUE"<USAGE> "COL_WHITE"/goto [ID]");
    if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFF0000AA, ""COL_RED"ERROR: "COL_WHITE"This player is not connected");
    GetPlayerName(playerid, an, MAX_PLAYER_NAME);
    GetPlayerName(ID, pn, MAX_PLAYER_NAME);
    new Float:x;
    new Float:y;
    new Float:z;
    GetPlayerPos(ID, x, y, z);
    SetPlayerPos(playerid, x+1, y+1, z);
    format(str, sizeof(str), "You have been teleported to %s", pn);
    SendClientMessage(playerid, 0x00FF00AA, str);
    if(IsPlayerInAnyVehicle(playerid))
    {
          GetPlayerPos(ID, x, y, z);
          SetVehiclePos(playerid, x+1, y+1, z);
    }
    return 1;
}

CMD:setleader(playerid, params[])
{
        if (PlayerInfo[playerid][pAdmin] <= 5) return SendClientMessage(playerid, 0xFF0000AA, "You have to be atleast Head Admin.");
    new string[256], targetid, faction, name[128];
    if(sscanf(params, "ui", targetid, faction))
    {
          SendClientMessage(playerid, 0xFFFFFFAA, ""COL_LIGHTBLUE"<Usage> "COL_WHITE"/leader [ID] [facID]");
          SendClientMessage(playerid, 0xFFFFFFAA, "1-LSPD | 2-CIA | 3-NG");
          return 1;
    }

    if(faction == 1) { name = "LSPD"; }
    else if(faction == 2) { name = "CIA"; }
    else if(faction == 3) { name = "NG"; }
    else { return 1; }

    PlayerInfo[targetid][pFac] = faction;
    PlayerInfo[targetid][pLead] = faction;

    new pname[256], tname[256];
    GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerName(targetid, tname, sizeof(tname));

    format(string, sizeof(string), "You made %s leader of %s.", tname, name);
    SendClientMessage(playerid, 0xFFFFFFAA, string);
    format(string, sizeof(string), "%s has made you leader of %s.", pname, name);
    SendClientMessage(targetid, 0xFFFFFFAA, string);
    return 1;
}

CMD:invite(playerid, params[])
{
    if(PlayerInfo[playerid][pLead] >= 1)
    {
          new string[256], targetid;
          if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFFFFFFAA, "Syntax: /invite [ID]");

          PlayerInfo[targetid][pFac] = PlayerInfo[playerid][pFac];

          new pname[256], tname[256];
          GetPlayerName(playerid, pname, sizeof(pname));
          GetPlayerName(targetid, tname, sizeof(tname));
          format(string, sizeof(string), "You have invited %s to your faction.", tname);
          SendClientMessage(playerid, 0xFFFFFFAA, string);
          format(string, sizeof(string), "%s has invited you to their faction.", pname);
          SendClientMessage(targetid, 0xFFFFFFAA, string);
    }
    else
    {
          SendClientMessage(playerid, 0xFFFFFFAA, "You're not a faction leader!");
    }
    return 1;
}

CMD:terminate(playerid, params[])
{
    if(PlayerInfo[playerid][pLead] >= 1)
    {
          new string[256], targetid;
          if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFFFFFFAA, "Syntax: /terminate [ID]");

          if(PlayerInfo[targetid][pFac] == PlayerInfo[playerid][pFac])
          {
              new pname[256], tname[256];
              GetPlayerName(playerid, pname, sizeof(pname));
              GetPlayerName(targetid, tname, sizeof(tname));
              format(string, sizeof(string), "You have removed %s from your faction.", tname);
              SendClientMessage(playerid, 0xFFFFFFAA, string);
              format(string, sizeof(string), "%s has removed you from their faction.", pname);
              SendClientMessage(targetid, 0xFFFFFFAA, string);

              PlayerInfo[targetid][pFac] = 0;
          }
          else
          {
              SendClientMessage(playerid, 0xFFFFFFAA, "The player you're trying to terminate is not from your faction!");
          }
    }
    else
    {
          SendClientMessage(playerid, 0xFFFFFFAA, "You're not a faction leader!");
    }
    return 1;
}

CMD:leavefac(playerid, params[])
{
    PlayerInfo[playerid][pFac] = 0;
    PlayerInfo[playerid][pLead] = 0;
    SendClientMessage(playerid, 0xFFFFFFAA, "You have left your current faction!");
    return 1;
}

CMD:aduty(playerid, params[])
{
        if (PlayerInfo[playerid][pAdmin] < 1)
            return SendClientMessage(playerid, COLOR_RED, "You don't have permission to use this command.");

        if (!PlayerInfo[playerid][pAdminDuty])
        {
                SetPlayerColor(playerid, 0x33CC3300);
               
                new pname[256], string[150];
        GetPlayerName(playerid, pname, sizeof(pname));
                PlayerInfo[playerid][pAdminDuty] = 1;
                format(string, sizeof(string), ""COL_LIGHTBLUE"%s "COL_WHITE"is now on duty as admin.", pname);
                SendClientMessageToAll(COLOR_GREEN, string);
        }
        else
        {
            SetPlayerColor(playerid, COLOR_WHITE);

                PlayerInfo[playerid][pAdminDuty] = 0;
                SendClientMessage(playerid, COLOR_WHITE, "You are no longer on admin duty.");
        }
        return 1;
}

CMD:admins(playerid, params[])
{
        new count = 0;
        new pname[256], string[150];
    SendClientMessage(playerid, COLOR_GREY, "-----------------------------------------------------------");

    foreach (new i : Player) if (PlayerInfo[i][pAdmin] > 0)
        {
        if (PlayerInfo[i][pAdminDuty])
        {
                        GetPlayerName(playerid, pname, sizeof(pname));
                        PlayerInfo[playerid][pAdminDuty] = 1;
                        format(string, sizeof(string), "%s - Admin Level: "COL_LIGHTBLUE"%d "COL_WHITE"("COL_GREEN"On Duty"COL_WHITE")", pname, PlayerInfo[playerid][pAdmin]);
                        SendClientMessageToAll(COLOR_WHITE, string);
                }
                else
                {
                          GetPlayerName(playerid, pname, sizeof(pname));
                        PlayerInfo[playerid][pAdminDuty] = 1;
                        format(string, sizeof(string), "%s - Admin Level: "COL_LIGHTBLUE"%d "COL_WHITE"("COL_RED"Off Duty"COL_WHITE")", pname, PlayerInfo[playerid][pAdmin]);
                        SendClientMessageToAll(COLOR_WHITE, string);
                }
        count++;
        }
        if (!count) {
            SendClientMessage(playerid, COLOR_WHITE, "* No admins online.");
        }
        SendClientMessage(playerid, COLOR_GREY, "-----------------------------------------------------------");
        return 1;
}

CMD:resetallactors(playerid, params[])
{
        if(IsPlayerAdmin(playerid))
        {
                for(new id = 0; id < MAX_ACTORSS; id ++)
                {
                        CreateActorInformation(id);
                        SaveActors(id);
                }
                SendClientMessage(playerid, -1, "You've created the files.");
        } else SendClientMessage(playerid, -1, "You're not authorized to use this command");
        return 1;
}

CMD:createactor(playerid, params[])
{
        new skin, text[32], string[128];
        if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "You can't do that in a vehicle.");
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You're not authorized to use this command");
        if(sscanf(params, "is[32]", skin, text))
        {
                SendClientMessage(playerid, -1, "/createactor [skin] [name]");
                return 1;
        }
        if(skin > 311 || skin < 0) return SendClientMessage(playerid, -1, "Skin ID is invalid(0-311).");
        for(new idx=0; idx<MAX_ACTORSS; idx++)
        {
                if(ActorInfo[idx][aPosX] == 0.0)
                {
                        GetPlayerPos(playerid, ActorInfo[idx][aPosX], ActorInfo[idx][aPosY], ActorInfo[idx][aPosZ]);
                        GetPlayerFacingAngle(playerid, ActorInfo[idx][aPosA]);
                        SetActorVirtualWorld(playerid, GetPlayerVirtualWorld(playerid));
                        ActorInfo[idx][aSkin] = skin;
                        format(ActorInfo[idx][aName], 32, "%s", text);

                        format(string,sizeof(string),"{00A2FF}%s (%d)", text ,idx);
                        ActorInfo[idx][aText] = CreateDynamic3DTextLabel(string,-1,ActorInfo[idx][aPosX],ActorInfo[idx][aPosY],ActorInfo[idx][aPosZ]+1,8.0);

                        CreateActorInformation(idx);
                        SaveActors(idx);
                        idx = MAX_ACTORSS;
                }
        }
        return 1;
}

CMD:deleteactor(playerid, params[])
{
        new id;
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You're not authorized to use this command");
        if(sscanf(params, "i", id)) return SendClientMessage(playerid, -1, "/deleteactor [id]");
        if(ActorInfo[id][aPosX] == 0.0) return SendClientMessage(playerid, -1, "Invaild ID");
        ActorInfo[id][aSkin] = 0;
        format(ActorInfo[id][aName], 32, "None");
        ActorInfo[id][aPosX] = 0;
          ActorInfo[id][aPosY] = 0;
          ActorInfo[id][aPosZ] = 0;
          ActorInfo[id][aPosA] = 0;
        ActorInfo[id][aVW] = 0;
        DestroyActor(id);
        DestroyDynamic3DTextLabel(ActorInfo[id][aText]);
        CreateActorInformation(id);
        SaveActors(id);
        return 1;
}


Vince 04/09/2015 04:51 PM

Re: Actors problem
 
Have you edited a_samp.inc? Or do you have a file called default.inc?

Also line 170: delete the extra semicolon after the function header.

mirou123 04/09/2015 04:53 PM

Re: Actors problem
 
Probably a missing closing bracket "}" there is a tool on here that helps you find it.
Here it is
http://forum.sa-mp.com/showthread.php?t=291018

AndreiWow 04/09/2015 05:04 PM

Re: Actors problem
 
Quote:

Originally Posted by Vince (Post 3568716)
Have you edited a_samp.inc? Or do you have a file called default.inc?

Also line 170: delete the extra semicolon after the function header.

No, I didn't edited? Or idk, I am using the includes from a gamemode that wasnt made by me, maybe that guy..


All times are GMT. The time now is 05:58 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.