How to fix toy shop
#1

Quote:

C:\Users\aspire\Desktop\FIN-GTA\gamemodes\None.pwn(17462) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\aspire\Desktop\FIN-GTA\gamemodes\None.pwn(17462) : warning 219: local variable "giveplayer" shadows a variable at a preceding level
C:\Users\aspire\Desktop\FIN-GTA\gamemodes\None.pwn(17462) : warning 204: symbol is assigned a value that is never used: "invoice"
C:\Users\aspire\Desktop\FIN-GTA\gamemodes\None.pwn(17462) : warning 204: symbol is assigned a value that is never used: "color"
C:\Users\aspire\Desktop\FIN-GTA\gamemodes\None.pwn(17462) : warning 203: symbol is never used: "giveplayer"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Warnings.

Script

Quote:

if(strcmp(cmd, "/vest", true) == 0)
{
new string[128], slot, giveplayer, color[32], invoice[64];
if(giveplayerid != INVALID_PLAYER_ID)
{
PlayerToyInfo[giveplayerid][slot][ptModelID] = 19142;
PlayerToyInfo[giveplayerid][slot][ptBone] = 1;
PlayerToyInfo[giveplayerid][slot][ptPosX] = 0.07998;
PlayerToyInfo[giveplayerid][slot][ptPosY] = 0.03999;
PlayerToyInfo[giveplayerid][slot][ptPosZ] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptRotX] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptRotY] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptRotZ] = 0.0;
format(string, sizeof(string), "You have been given a police vest in slot %d, use /toys to manage it", slot);
SendClientMessage(giveplayerid, COLOR_LIGHTGREEN, string);
}
return 1;
}

Reply
#2

pawn Код:
if(strcmp(cmd, "/vest", true) == 0)
{
new string2[128], slot;
if(giveplayerid != INVALID_PLAYER_ID)
{
PlayerToyInfo[giveplayerid][slot][ptModelID] = 19142;
PlayerToyInfo[giveplayerid][slot][ptBone] = 1;
PlayerToyInfo[giveplayerid][slot][ptPosX] = 0.07998;
PlayerToyInfo[giveplayerid][slot][ptPosY] = 0.03999;
PlayerToyInfo[giveplayerid][slot][ptPosZ] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptRotX] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptRotY] = 0.0;
PlayerToyInfo[giveplayerid][slot][ptRotZ] = 0.0;
format(string2, sizeof(string2), "You have been given a police vest in slot %d, use /toys to manage it", slot);
SendClientMessage(giveplayerid, COLOR_LIGHTGREEN, string2);
}
return 1;
}
Should work.
Reply
#3

I Want to giveplayer and slot toy , color invoice in slot
Reply
#4

You want to give an other player a vest?
Then try this:

pawn Код:
if(strcmp(cmd, "/vest", true) == 0)
    {
        new tmp[128],slot,string2[128];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, 0xFFFFFFAA,"[USAGE] /vest [playerid] [slot]");
            return 1;
        }
        giveplayerid = strval(tmp);

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, 0xFFFFFFAA,"[USAGE] /vest [playerid] [slot]");
            return 1;
        }
        slot = strval(tmp);

        if (IsPlayerConnected(giveplayerid))
        {
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
           
            PlayerToyInfo[giveplayerid][slot][ptModelID] = 19142;
            PlayerToyInfo[giveplayerid][slot][ptBone] = 1;
            PlayerToyInfo[giveplayerid][slot][ptPosX] = 0.07998;
            PlayerToyInfo[giveplayerid][slot][ptPosY] = 0.03999;
            PlayerToyInfo[giveplayerid][slot][ptPosZ] = 0.0;
            PlayerToyInfo[giveplayerid][slot][ptRotX] = 0.0;
            PlayerToyInfo[giveplayerid][slot][ptRotY] = 0.0;
            PlayerToyInfo[giveplayerid][slot][ptRotZ] = 0.0;
            format(string2, sizeof(string2), "You have been given a police vest in slot %d, use /toys to manage it", slot);
            SendClientMessage(giveplayerid, COLOR_LIGHTGREEN, string2);
        }
        else
        {
            format(string2, sizeof(string2), "<ERROR> %d is not connected!", giveplayerid);
            SendClientMessage(playerid, COLOR_RED, string2);
        }
        return 1;
    }
Reply
#5

Thanks. you very much XD
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)