28.05.2014, 23:41
Good morning.
So I have a system object that I ask / pick.
So I use the switch in my collection since there are several types of tabletop objects (Money, drugs) ...
But suddenly if I switch my application uses several equivalent to id = 0 while if I use only one (from switch) everything works ...
Here is the code when it's good:
And here there or it does not work:
Can you help me?
So I have a system object that I ask / pick.
So I use the switch in my collection since there are several types of tabletop objects (Money, drugs) ...
But suddenly if I switch my application uses several equivalent to id = 0 while if I use only one (from switch) everything works ...
Here is the code when it's good:
pawn Код:
if(strcmp(cmd, "/ramasser", true) == 0)
{
for(new xdd = 0; xdd < sizeof(ObjetsInfo); xdd++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, ObjetsInfo[xdd][PosX], ObjetsInfo[xdd][PosY], ObjetsInfo[xdd][PosZ]) && ObjetsInfo[xdd][VW] == GetPlayerVirtualWorld(playerid) && ObjetsInfo[xdd][Inte] == GetPlayerInterior(playerid))
{
DestroyDynamicObject(ObjetsAuSol[xdd]);
ObjetsInfo[xdd][ID] = 0;
ObjetsInfo[xdd][IDOBJET] = 0;
ObjetsInfo[xdd][PosX] = 0;
ObjetsInfo[xdd][PosY] = 0;
ObjetsInfo[xdd][PosZ] = 0;
switch(ObjetsInfo[xdd][SommeArgent])
{
case 0: ObjetsInfo[xdd][SommeArgent] = 0;
default:
{
format(string, sizeof(string), "Vous venez de ramasser une liasse de $%d au sol.", ObjetsInfo[xdd][SommeArgent]);
SendClientMessage(playerid, COLOR_RPIT, string);
SafeGivePlayerMoney(playerid, ObjetsInfo[xdd][SommeArgent]);
ObjetsInfo[xdd][SommeArgent] = 0;
}
}
format(string, sizeof(string), "DELETE FROM `srp_players_objets` WHERE ID=%d", xdd);
mysql_query(string);
}
}
return 1;
}
pawn Код:
if(strcmp(cmd, "/ramasser", true) == 0)
{
for(new xdd = 0; xdd < sizeof(ObjetsInfo); xdd++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, ObjetsInfo[xdd][PosX], ObjetsInfo[xdd][PosY], ObjetsInfo[xdd][PosZ]) && ObjetsInfo[xdd][VW] == GetPlayerVirtualWorld(playerid) && ObjetsInfo[xdd][Inte] == GetPlayerInterior(playerid))
{
DestroyDynamicObject(ObjetsAuSol[xdd]);
ObjetsInfo[xdd][ID] = 0;
ObjetsInfo[xdd][IDOBJET] = 0;
ObjetsInfo[xdd][PosX] = 0;
ObjetsInfo[xdd][PosY] = 0;
ObjetsInfo[xdd][PosZ] = 0;
switch(ObjetsInfo[xdd][QteMatos])
{
case 0: ObjetsInfo[xdd][QteMatos] = 0;
default:
{
format(string, sizeof(string), "Vous venez de ramasser %d matйriels dans un paquet au sol.", ObjetsInfo[xdd][QteMatos]);
SendClientMessage(playerid, COLOR_RPIT, string);
ObjetsInfo[xdd][QteMatos] = 0;
}
}
switch(ObjetsInfo[xdd][IdArme])
{
case 0:
{
ObjetsInfo[xdd][IdArme] = 0;
ObjetsInfo[xdd][Ammo] = 0;
}
default:
{
format(string, sizeof(string), "Vous venez de ramasser une arme au sol contenant %d munitions.", ObjetsInfo[xdd][Ammo]);
SendClientMessage(playerid, COLOR_RPIT, string);
SafeGivePlayerWeapon(playerid, ObjetsInfo[xdd][IdArme], ObjetsInfo[xdd][Ammo]);
ObjetsInfo[xdd][IdArme] = 0;
ObjetsInfo[xdd][Ammo] = 0;
}
}
switch(ObjetsInfo[xdd][SommeArgent])
{
case 0: ObjetsInfo[xdd][SommeArgent] = 0;
default:
{
format(string, sizeof(string), "Vous venez de ramasser une liasse de $%d au sol.", ObjetsInfo[xdd][SommeArgent]);
SendClientMessage(playerid, COLOR_RPIT, string);
SafeGivePlayerMoney(playerid, ObjetsInfo[xdd][SommeArgent]);
ObjetsInfo[xdd][SommeArgent] = 0;
}
}
switch(ObjetsInfo[xdd][VarieteWeed])
{
case 1:
{
format(string, sizeof(string), "Vous venez de ramasser %d grammes d'Amnйsia dans un sachet au sol.", ObjetsInfo[xdd][GrammesWeed]);
SendClientMessage(playerid, COLOR_RPIT, string);
PlayerInfo[playerid][pGrammesAmne] += ObjetsInfo[xdd][GrammesWeed];
ObjetsInfo[xdd][VarieteWeed] = 0;
ObjetsInfo[xdd][GrammesWeed] = 0;
}
case 2:
{
format(string, sizeof(string), "Vous venez de ramasser %d grammes de Skunk dans un sachet au sol.", ObjetsInfo[xdd][GrammesWeed]);
SendClientMessage(playerid, COLOR_RPIT, string);
PlayerInfo[playerid][pGrammesSkunk] += ObjetsInfo[xdd][GrammesWeed];
ObjetsInfo[xdd][VarieteWeed] = 0;
ObjetsInfo[xdd][GrammesWeed] = 0;
}
case 3:
{
format(string, sizeof(string), "Vous venez de ramasser %d grammes de White Widow dans un sachet au sol.", ObjetsInfo[xdd][GrammesWeed]);
SendClientMessage(playerid, COLOR_RPIT, string);
PlayerInfo[playerid][pGrammesWhiteW] += ObjetsInfo[xdd][GrammesWeed];
ObjetsInfo[xdd][VarieteWeed] = 0;
ObjetsInfo[xdd][GrammesWeed] = 0;
}
default:
{
ObjetsInfo[xdd][VarieteWeed] = 0;
ObjetsInfo[xdd][GrammesWeed] = 0;
}
}
format(string, sizeof(string), "DELETE FROM `srp_players_objets` WHERE ID=%d", xdd);
mysql_query(string);
}
}
return 1;
}