Error SAMP
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Update your foreach.inc to the latest version and it should be like:
pawn Код:
#include <a_samp>
#include <foreach>

// rest..

// Admin Commands
dcmd_givegun(playerid, params[]) // Level 2
{
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not authorized to use this command!");
    new target, weaponid, string[128];
    if(sscanf(params, "ud", target, weaponid)) return SendClientMessage(playerid, COLOR_ORANGE, "CMD: /givegun [playerid/name] [weaponid]");
    if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_LIGHTRED, "Invalid player id!");
    if(weaponid < 0 || weaponid > 46) return SendClientMessage(playerid, COLOR_LIGHTRED, "Invalid weapon ID! (0 - 46)");
    GivePlayerWeapon(target, weaponid, 500);
    format(string, sizeof(string), "Admin %s has given you a weapon!", PlayerName(playerid));
    SendClientMessage(target, COLOR_LIGHTGREEN, string);
    return 1;
}

dcmd_makeadmin(playerid, params[]) // Level 5
{
    if(PlayerInfo[playerid][pAdmin] < 5 || !IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_LIGHTRED, "You are not authorized to use this command!");
    new target, level, string[128];
    if(sscanf(params, "ud", target, level)) return SendClientMessage(playerid, COLOR_ORANGE, "CMD: /makeadmin [playerid/name] [0-5]");
    if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_LIGHTRED, "Invalid player id!");
    PlayerInfo[target][pAdmin] = level;
    format(string, sizeof(string), "Admin %s has given you Level %d Admin!", PlayerName(playerid), level);
    SendClientMessage(target, COLOR_LIGHTGREEN, string);
    foreach(new i : Player)  // <--- error here
    {
        if(PlayerInfo[i][pAdmin] >= 4)
        {
            format(string, sizeof(string), "Admin %s has given %s level %d Admin!", PlayerName(playerid), PlayerName(target), level);
            SendClientMessage(i, COLOR_LIGHTRED, string);
        }
    }
    return 1;
}
dcmd_setmoney(playerid, params[]) // Level 3
{
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not authorized to use this command!");
    new target, amount;
    new string[128];
    if(sscanf(params, "ud", target, amount)) return SendClientMessage(playerid, COLOR_ORANGE, "CMD: /setmoney [playerid/name] [amount]");
    if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_LIGHTRED, "Invalid player id!");
    PlayerInfo[target][pMoney] = amount;
    ResetPlayerMoney(target);
    new newmoney = PlayerInfo[target][pMoney];
    GivePlayerMoney(target, newmoney);
    format(string, sizeof(string), "Admin %s has set your money to %d !", PlayerName(playerid), newmoney);
    SendClientMessage(target, COLOR_LIGHTGREEN, string);
    foreach(new i : Player)
    {
        if (PlayerInfo[i][pAdmin] >= 1)
        {
            format(string, sizeof(string), "Admin %s has set %s's money to %d !", PlayerName(playerid), PlayerName(target), amount);
            SendClientMessage(i, COLOR_LIGHTRED, string);
        }
    }
    return 1;
}

dcmd_givemoney(playerid, params[]) // Level 3
{
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not authorized to use this command!");
    new target, money;
    new string[128];
    if(sscanf(params, "ud", target, money)) return SendClientMessage(playerid, COLOR_ORANGE, "CMD: /givemoney [playerid/name] [amount]");
    if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_LIGHTRED, "Invalid player id!");
    if(money < 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You can't givemoney below 0!");
    GivePlayerMoney(target, money);
    PlayerInfo[target][pMoney] += money;
    format(string, sizeof(string), "Admin %s has given you %d !", PlayerName(playerid), money);
    SendClientMessage(target, COLOR_LIGHTGREEN, string);
    foreach(new i : Player)
    {
        if(PlayerInfo[i][pAdmin] >=1)
        {
            format(string, sizeof(string), "Admin %s has given %s %d !", PlayerName(playerid), PlayerName(target), money);
            SendClientMessage(i, COLOR_LIGHTRED, string);
        }
    }
    return 1;
}
dcmd_kick(playerid, params[]) // Level 1
{
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not authorized to use this command!");
    new user, reason[128], string[128];
    if(sscanf(params, "us[128]", user, reason)) return SendClientMessage(playerid, COLOR_ORANGE, "CMD: /kick [playerid/name] [reason]");
    if(!IsPlayerConnected(user)) return SendClientMessage(playerid, COLOR_LIGHTRED, "Invalid player id!");
    if(PlayerInfo[user][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_LIGHTRED, "You can't kick higher level Admins!");
    format(reason, sizeof(reason), "%s", reason);
    format(string, sizeof(string), "Admin %s has kicked %s, reason: %s", PlayerName(playerid), PlayerName(user), reason);
    SendClientMessageToAll(COLOR_LIGHTRED, string);
    Kick(user);
    return 1;
}

dcmd_veh(playerid, params[]) // Level 3
{
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not authorized to use this command!");
    if( !strlen( params ) ) return SendClientMessage(playerid, COLOR_LIGHTRED, "/veh [name] or [modelid]");
    new car = ReturnVehicleModelID(params);
    if(!car) return SendClientMessage(playerid, COLOR_LIGHTRED, "Invalid vehicle model id!");
    new Float:x,Float:y,Float:z,Float:a;
    GetPlayerPos(playerid, x,y,z);
    GetPlayerFacingAngle(playerid, a);
    CreateVehicle(car, x+1, y+1, z, a, -1, -1, 500);
    SendClientMessage(playerid, COLOR_LIGHTGREEN, "You've spawned a vehicle!");
    return 1;
}
About the line 1141, I assume you used return and after that you have code. Remove that return from there.
Still not working buddy!I have latest version and still

Код:
C:\Users\Dennis Laptop\Desktop\latw.pwn(1450) : error 017: undefined symbol "foreach"
C:\Users\Dennis Laptop\Desktop\latw.pwn(1450) : error 029: invalid expression, assumed zero
C:\Users\Dennis Laptop\Desktop\latw.pwn(1450) : error 029: invalid expression, assumed zero
C:\Users\Dennis Laptop\Desktop\latw.pwn(1450) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
HELP and i rep++
Reply


Messages In This Thread
Error SAMP - by denniser8 - 28.09.2013, 12:17
Re: Error SAMP - by Konstantinos - 28.09.2013, 12:20
Re: Error SAMP - by denniser8 - 28.09.2013, 14:08
Re: Error SAMP - by Konstantinos - 28.09.2013, 14:11
Re: Error SAMP - by denniser8 - 28.09.2013, 14:11

Forum Jump:


Users browsing this thread: 1 Guest(s)