PDA

View Full Version : How to fix toy shop


arititlez
23/07/2013, 09:09 AM
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 (c) 1997-2006, ITB CompuPhase


5 Warnings.



Script

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

JimmyCh
23/07/2013, 09:12 AM
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.

arititlez
23/07/2013, 09:14 AM
I Want to giveplayer and slot toy , color invoice in slot :(

Macronix
23/07/2013, 09:43 AM
You want to give an other player a vest?
Then try this:

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

arititlez
23/07/2013, 12:01 PM
Thanks. you very much XD