givegun and slap
#1

I have some problems with slap.. it doesnt show the meters..

here it is
pawn Код:
dcmd_slap(playerid,params[])
{
    if(!PLVL[playerid]) return 0;
    new pid;
    if(PlayerInfo[playerid][pAdminLevel] >=1)
    {
        if(sscanf(params, "u", pid)) return SendClientMessage(playerid, Yellow, "Usage: /slap <playerid>");
        if(IsPlayerConnected(pid))
        {
        new Float:Pos[3], string[128], adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], moneys = strval(params);
        GetPlayerPos(pid,Pos[0],Pos[1],Pos[2]);
        SetPlayerPos(pid,Pos[0],Pos[1],Pos[2]+moneys);
        format(string, sizeof(string), "Admin %s has slapped %s for %d meters", adminname, paramname, moneys);
        MessageToAdmins(AdminColor, string);
        } else SendClientMessage(playerid, Red, "This player is not connected");
    } else if(PlayerInfo[playerid][pAdminLevel] == 0) return 0;
    return 1;
}
here is the givegun code, it says palyerisnot connected when i use my id also the gun name dont work

pawn Код:
dcmd_givegun(playerid, params[])
{
    if(!PLVL[playerid]) return 0;
    new id, gunid, ammo, gunname[50];
    new idx, String[128];
    String = strtok(params, idx);
    if(PlayerInfo[playerid][pAdminLevel] < 3) return 0;
    if(sscanf(params, "dsd", id, gunid, ammo)) return SendClientMessage(playerid, Yellow, "Usage: /givegun <playerid> <weaponid/name> <ammo>");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, Red, "Player is not connected");
    if(gunid < 0 || gunid > 46) return SendClientMessage(playerid, Red, "Invalid weapon ID/name");
    GetWeaponModelIDFromName(String);
    if (!strlen(String))
    if (!strlen(params[idx+1]))
    GivePlayerWeapon(id, gunid, ammo);
    GetGunName(gunid, gunname, 50);
    format(String, 128, "Admin has given you a %s with %d bullets", gunname, ammo);
    SendClientMessage(id, AdminColor, String);
    return 1;
}
please help , i tried hard but still..
Reply
#2

pawn Код:
dcmd_givegun(playerid, params[])
{
    if(!PLVL[playerid]) return 0;
    new id, gunid, ammo, gunname[32];
    new idx, String[128];
    String = strtok(params, idx);
    if(PlayerInfo[playerid][pAdminLevel] < 3) return 0;
    if(sscanf(params, "udd", id, gunid, ammo)) return SendClientMessage(playerid, Yellow, "Usage: /givegun <playerid> <weaponid/name> <ammo>");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, Red, "Player is not connected");
    if(gunid < 0 || gunid > 46) return SendClientMessage(playerid, Red, "Invalid weapon ID/name");
    GetWeaponModelIDFromName(String);
    if (!strlen(String))
    if (!strlen(params[idx+1]))
    GivePlayerWeapon(id, gunid, ammo);
    GetWeaponName(gunid,gunname,32);
    format(String, 128, "Admin has given you a %s with %d bullets", gunname, ammo);
    SendClientMessage(id, AdminColor, String);
    return 1;
}
Reply
#3

it says Admin has given you a Desert Eagle with 0 Bullets, when I typed 50. also the gun name doesnt work
Reply
#4

not fixed yet please help
Reply
#5

pawn Код:
if(sscanf(params, "usd", id, gunid, ammo)) return SendClientMessage(playerid, Yellow, "Usage: /givegun <playerid> <weaponid/name> <ammo>");
Try replacing the line in your script with this one.
Reply
#6

Quote:
Originally Posted by kreso932
Посмотреть сообщение
pawn Код:
if(sscanf(params, "usd", id, gunid, ammo)) return SendClientMessage(playerid, Yellow, "Usage: /givegun <playerid> <weaponid/name> <ammo>");
Try replacing the line in your script with this one.
It should be:
pawn Код:
if(sscanf(params, "udd", id, gunid, ammo)) return SendClientMessage(playerid, Yellow, "Usage: /givegun <playerid> <weaponid/name> <ammo>");
Reply
#7

The code doesnt still work , please help
Reply
#8

bump
Reply
#9

pawn Код:
dcmd_slap(playerid,params[])
{
    if(!PLVL[playerid]) return 0;
    new pid, moneys;
    if(PlayerInfo[playerid][pAdminLevel] >=1)
    {
        if(sscanf(params, "ud", pid, moneys)) return SendClientMessage(playerid, Yellow, "Usage: /slap <playerid>");
        if(IsPlayerConnected(pid))
        {
        new Float:Pos[3], string[128], adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], moneys = strval(params);
        GetPlayerPos(pid,Pos[0],Pos[1],Pos[2]);
        SetPlayerPos(pid,Pos[0],Pos[1],Pos[2]+moneys);
        format(string, sizeof(string), "Admin %s has slapped %s for %d meters", adminname, paramname, moneys);
        MessageToAdmins(AdminColor, string);
        } else SendClientMessage(playerid, Red, "This player is not connected");
    } else if(PlayerInfo[playerid][pAdminLevel] == 0) return 0;
    return 1;
}
Reply
#10

hm
pawn Код:
E:\GTA San Andreas\Server\gamemodes\DMWorld.pwn(1119) : warning 219: local variable "moneys" shadows a variable at a preceding level
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
and what about the givegun cmd?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)