28.06.2016, 19:53
Why is this command making my game freeze?
pawn Код:
if (strcmp(cmd, "/checkcars", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] & ADMIN_LOWLEVEL)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, ""COL_SZR"Usage:"COL_WHITE" /checkcars [playerid/PartOfName]");
return 1;
}
//giveplayerid = strval(tmp);
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
for (new i = 0; i < sizeof(CarInfo); i++) {
if (PlayerInfo[giveplayerid][pCarkey] == SCRIPT_CARS)
if (PlayerInfo[giveplayerid][pCarkey2] == SCRIPT_CARS)
if (PlayerInfo[giveplayerid][pCarkey3] == SCRIPT_CARS)
if (PlayerInfo[giveplayerid][pCarkey4] == SCRIPT_CARS)
if (PlayerInfo[giveplayerid][pCarkey5] == SCRIPT_CARS) {
SendClientMessage(playerid, COLOR_GREY, "No vehicles found.");
return 1;
}
new carkey = PlayerInfo[giveplayerid][pCarkey],
carkey2 = PlayerInfo[giveplayerid][pCarkey2],
carkey3 = PlayerInfo[giveplayerid][pCarkey3],
carkey4 = PlayerInfo[giveplayerid][pCarkey4],
carkey5 = PlayerInfo[giveplayerid][pCarkey5];
if (PlayerInfo[giveplayerid][pCarkey] != SCRIPT_CARS) {
format(string, sizeof(string), ""COL_GREY"1. {FF6347}%s"COL_GREY" Value[%d] Dest[%d] Insure[%d] Plate[%s] Impounded[%d] Impound Price[%d]", CarInfo[carkey][cDescription], CarInfo[carkey][cValue], CarInfo[carkey][cDestroys], CarInfo[carkey][cInsure], CarInfo[carkey][cPlate], CarInfo[carkey][cImpounded], CarInfo[carkey][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
if (PlayerInfo[giveplayerid][pCarkey2] != SCRIPT_CARS) {
format(string, sizeof(string), ""COL_GREY"2. {FF6347}%s"COL_GREY" Value[%d] Dest[%d] Insure[%d] Plate[%s] Impounded[%d] Impound Price[%d]", CarInfo[carkey2][cDescription], CarInfo[carkey2][cValue], CarInfo[carkey2][cDestroys], CarInfo[carkey2][cInsure], CarInfo[carkey2][cPlate], CarInfo[carkey2][cImpounded], CarInfo[carkey2][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
if (PlayerInfo[giveplayerid][pCarkey3] != SCRIPT_CARS) {
format(string, sizeof(string), ""COL_GREY"3. {FF6347}%s"COL_GREY" Value[%d] Dest[%d] Insure[%d] Plate[%s] Impounded[%d] Impound Price[%d]", CarInfo[carkey3][cDescription], CarInfo[carkey3][cValue], CarInfo[carkey3][cDestroys], CarInfo[carkey3][cInsure], CarInfo[carkey3][cPlate], CarInfo[carkey3][cImpounded], CarInfo[carkey3][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
if (PlayerInfo[giveplayerid][pCarkey4] != SCRIPT_CARS) {
format(string, sizeof(string), ""COL_GREY"4. {FF6347}%s"COL_GREY" Value[%d] Dest[%d] Insure[%d] Plate[%s] Impounded[%d] Impound Price[%d]", CarInfo[carkey4][cDescription], CarInfo[carkey4][cValue], CarInfo[carkey4][cDestroys], CarInfo[carkey4][cInsure], CarInfo[carkey4][cPlate], CarInfo[carkey4][cImpounded], CarInfo[carkey4][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
if (PlayerInfo[giveplayerid][pCarkey5] != SCRIPT_CARS) {
format(string, sizeof(string), ""COL_GREY"5. {FF6347}%s"COL_GREY" Value[%d] Dest[%d] Insure[%d] Plate[%s] Impounded[%d] Impound Price[%d]", CarInfo[carkey5][cDescription], CarInfo[carkey5][cValue], CarInfo[carkey5][cDestroys], CarInfo[carkey5][cInsure], CarInfo[carkey5][cPlate], CarInfo[carkey5][cImpounded], CarInfo[carkey5][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " No Such Player");
}
}
else
{
SendClientMessage(playerid, GREY, AdminOnly);
}
}
return 1;
}