SA-MP Forums Archive
[COMPILE ERROR] Prox Detector - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [COMPILE ERROR] Prox Detector (/showthread.php?tid=338977)



[COMPILE ERROR] Prox Detector - NewerthRoleplay - 01.05.2012

These are the errors,

pawn Код:
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(619) : error 080: unknown symbol, or not a constant symbol (symbol "i")
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(678) : error 017: undefined symbol "pName"
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(679) : error 017: undefined symbol "gName"
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(680) : error 017: undefined symbol "pName"
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(681) : error 017: undefined symbol "gName"
Pawn compiler 3.2.3664 * * Copyright (c) 1997-2006, ITB CompuPhase
And this is the surrounding lines,
Lines 619 - 683
pawn Код:
stock strreplace(string[], find, replace)
{
    for(new i=0; i < sizeof(string[i]); i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }
}
//===============================[COMMANDS]=====================================
CMD:veh(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_RED, " ** You must be a level 3 Admin to use that! ");
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Use /veh [vehicle id]");
    if(strval(params) < 400 || strval(params) > 611) return SendClientMessage(playerid, COLOR_RED, "Invalid vehicle model.");
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    CreateVehicle(strval(params), x+2, y+2, z, 90.0, 0, 0, 0);
    return 1;
}
CMD:goto(playerid, params[])
{
    new targetid;
    if(sscanf(params, "u", targetid)) SendClientMessage(playerid, 0xFF0000FF, "USAGE: /goto [id]");
    else if(!IsPlayerConnected(targetid) || targetid == playerid) return SendClientMessage(playerid, 0xFF0000FF, "This player is offline or it is yourself");
    else
    {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(targetid, x, y, z);
    SetPlayerPos(playerid, x+1, y+1, z);
    }
    return 1;
}
CMD:gethere(playerid,params[])
{
    new targetid, Float:x, Float:y, Float:z;
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /gethere [id]");
    if(!IsPlayerConnected(targetid) || targetid == playerid) return SendClientMessage(playerid, 0xFF0000FF, "This player is offline or it is yourself");
    SetPlayerPos(targetid, x+1, y+1, z);
    return 1;
}
CMD:afix(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4)
    {
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
    }
    else SendClientMessage(playerid, COLOR_RED, "You must be an admin to use this command");
    return 1;
}
CMD:setfaction(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] <= 5) return SendClientMessage(playerid, COLOR_RED, " ** You need to be a level 5 admin to do that!");
    {
    new otherplayerid;
    new faction;
    if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_RED, " ** They are not online!");
    if(sscanf(params, "u", otherplayerid, faction)) return SendClientMessage(playerid, COLOR_RED, "Use /setfaction [playerid/name] [faction number 1 - 11]");
    GetPlayerName(playerid, pName, 24);
    GetPlayerName(otherplayerid, gName, 24);
    SendClientMessage(otherplayerid, COLOR_GREEN, " ** Admin %s has set your faction to %s",pName,faction);
    SendClientMessage(playerid, COLOR_GREEN, " ** You have set player %s faction to %s",gName,faction);
    PlayerInfo[otherplayerid][gTeam] = faction;
    }
    return 1;
}

Please explain what you changed, otherwise ill never learn what to do


Re: [COMPILE ERROR] Prox Detector - Passout - 01.05.2012

Define "gName"

new name[MAX_PLAYER_NAME];
new gName = GetPlayerName(playerid, name, sizeof(name));

show me line 619 there is an "i" that is not needed


Re: [COMPILE ERROR] Prox Detector - pyrodave - 01.05.2012

pawn Код:
stock strreplace(string[], find, replace)
{
    new len = strlen(string);
    while(len--)
    {
        if(string[len] == find) string[len] = replace;
    }
     return string;
}
And

pawn Код:
CMD:setfaction(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] <= 5) return SendClientMessage(playerid, COLOR_RED, " ** You need to be a level 5 admin to do that!");
   
    new otherplayerid;
    new faction;
    new pName[MAX_PLAYER_NAME], gName[MAX_PLAYER_NAME];
    if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_RED, " ** They are not online!");
    if(sscanf(params, "u", otherplayerid, faction)) return SendClientMessage(playerid, COLOR_RED, "Use /setfaction [playerid/name] [faction number 1 - 11]");
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    GetPlayerName(otherplayerid, gName, MAX_PLAYER_NAME);
    SendClientMessage(otherplayerid, COLOR_GREEN, " ** Admin %s has set your faction to %s",pName,faction);
    SendClientMessage(playerid, COLOR_GREEN, " ** You have set player %s faction to %s",gName,faction);
    PlayerInfo[otherplayerid][gTeam] = faction;  
    return 1;
}



Re: [COMPILE ERROR] Prox Detector - Biesmen - 02.05.2012

Quote:
Originally Posted by Passout
Посмотреть сообщение
Define "gName"

new name[MAX_PLAYER_NAME];
new gName = GetPlayerName(playerid, name, sizeof(name));

show me line 619 there is an "i" that is not needed
What are you doing? You obviously have no idea how GetPlayerName works.
https://sampwiki.blast.hk/wiki/GetPlayerName

If you just use
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
The array name will already be defined with the name of the player.