SA-MP Forums Archive
How to fix toy shop - 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: How to fix toy shop (/showthread.php?tid=452926)



How to fix toy shop - arititlez - 23.07.2013

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;
}




Re: How to fix toy shop - JimmyCh - 23.07.2013

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.


Re: How to fix toy shop - arititlez - 23.07.2013

I Want to giveplayer and slot toy , color invoice in slot


AW: How to fix toy shop - Macronix - 23.07.2013

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;
    }



Re: How to fix toy shop - arititlez - 23.07.2013

Thanks. you very much XD