if(strcmp(cmdtext, "/fixcar", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "* Usuage: /fixcar [Player ID/part of name]");
return 1;
}
print("Before giveplayerid returnuser");
giveplayerid = ReturnUser(tmp);
print("After giveplayerid return user");
if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[playerid][pAdmin] >= 99999)
{
if(PlayerInfo[giveplayerid][pVehicle] == 1)
{
PlayerInfo[giveplayerid][pVehicle] = 0;
format(string, sizeof(string), "* You set %s's car value to 0.", PlayerName(giveplayerid));
SendClientMessage(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "* Admin %s set your car value to 0.", PlayerName(playerid));
SendClientMessage(giveplayerid, COLOR_GREY, string);
return 1;
}
if(PlayerInfo[giveplayerid][pVehicle] == 0)
{
PlayerInfo[giveplayerid][pVehicle] = 1;
format(string, sizeof(string), "* You set %s's car value to 1.", PlayerName(giveplayerid));
SendClientMessage(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "* Admin %s set your car value to 1.", PlayerName(playerid));
SendClientMessage(giveplayerid, COLOR_GREY, string);
return 1;
}
}
else SendClientMessage(playerid, COLOR_GREY, "* User is not connected !");
}
return 1;
}
COMMAND:fixcar(playerid, params[])
{
new giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /fixcar [Player ID/part of name]");
if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
if(PlayerInfo[playerid][pAdmin] >=! 99999) return SendClientMessage(playerid, COLOR_RED, "You are not an admin");
if(PlayerInfo[giveplayerid][pVehicle] == 1)
{
PlayerInfo[giveplayerid][pVehicle] = 0;
format(string, sizeof(string), "* You set %s's car value to 0.", PlayerName(giveplayerid));
SendClientMessage(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "* Admin %s set your car value to 0.", PlayerName(playerid));
SendClientMessage(giveplayerid, COLOR_GREY, string);
}
else if(PlayerInfo[giveplayerid][pVehicle] == 0)
{
PlayerInfo[giveplayerid][pVehicle] = 1;
format(string, sizeof(string), "* You set %s's car value to 1.", PlayerName(giveplayerid));
SendClientMessage(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "* Admin %s set your car value to 1.", PlayerName(playerid));
SendClientMessage(giveplayerid, COLOR_GREY, string);
}
return 1;
}
if(strcmp(cmdtext, "/fixcar", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "* Usuage: /fixcar [Player ID/part of name]"); return 1; } print("Before giveplayerid returnuser"); giveplayerid = ReturnUser(tmp); print("After giveplayerid return user"); if(IsPlayerConnected(giveplayerid)) { if(PlayerInfo[playerid][pAdmin] >= 99999) /////=========>are you level 99999 { if(PlayerInfo[giveplayerid][pVehicle] == 1) { PlayerInfo[giveplayerid][pVehicle] = 0; format(string, sizeof(string), "* You set %s's car value to 0.", PlayerName(giveplayerid)); SendClientMessage(playerid, COLOR_LIGHTRED, string); format(string, sizeof(string), "* Admin %s set your car value to 0.", PlayerName(playerid)); SendClientMessage(giveplayerid, COLOR_GREY, string); return 1; } if(PlayerInfo[giveplayerid][pVehicle] == 0) { PlayerInfo[giveplayerid][pVehicle] = 1; format(string, sizeof(string), "* You set %s's car value to 1.", PlayerName(giveplayerid)); SendClientMessage(playerid, COLOR_LIGHTRED, string); format(string, sizeof(string), "* Admin %s set your car value to 1.", PlayerName(playerid)); SendClientMessage(giveplayerid, COLOR_GREY, string); return 1; } } else SendClientMessage(playerid, COLOR_GREY, "* User is not connected !");//======>this cant go here i think } return 1; }
if(strcmp(cmdtext, "/fixcar", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "* Usuage: /fixcar [Player ID/part of name]"); return 1; } print("Before giveplayerid returnuser"); giveplayerid = ReturnUser(tmp); print("After giveplayerid return user"); if(IsPlayerConnected(giveplayerid)) { if(PlayerInfo[playerid][pAdmin] >= 99999) { if(PlayerInfo[giveplayerid][pVehicle] == 1) { PlayerInfo[giveplayerid][pVehicle] = 0; format(string, sizeof(string), "* You set %s's car value to 0.", PlayerName(giveplayerid)); SendClientMessage(playerid, COLOR_LIGHTRED, string); format(string, sizeof(string), "* Admin %s set your car value to 0.", PlayerName(playerid)); SendClientMessage(giveplayerid, COLOR_GREY, string); return 1; } if(PlayerInfo[giveplayerid][pVehicle] == 0) { PlayerInfo[giveplayerid][pVehicle] = 1; format(string, sizeof(string), "* You set %s's car value to 1.", PlayerName(giveplayerid)); SendClientMessage(playerid, COLOR_LIGHTRED, string); format(string, sizeof(string), "* Admin %s set your car value to 1.", PlayerName(playerid)); SendClientMessage(giveplayerid, COLOR_GREY, string); return 1; } } else return SendClientMessage(playerid, COLOR_GREY, "* you are not lvl 99999 admin !"); } else return SendClientMessage(playerid, COLOR_GREY, "* player not connected !"); //return 1; }
Код:
if(strcmp(cmdtext, "/fixcar", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "* Usuage: /fixcar [Player ID/part of name]"); return 1; } print("Before giveplayerid returnuser"); giveplayerid = ReturnUser(tmp); print("After giveplayerid return user"); if(IsPlayerConnected(giveplayerid)) { if(PlayerInfo[playerid][pAdmin] >= 99999) /////=========>are you level 99999 { if(PlayerInfo[giveplayerid][pVehicle] == 1) { PlayerInfo[giveplayerid][pVehicle] = 0; format(string, sizeof(string), "* You set %s's car value to 0.", PlayerName(giveplayerid)); SendClientMessage(playerid, COLOR_LIGHTRED, string); format(string, sizeof(string), "* Admin %s set your car value to 0.", PlayerName(playerid)); SendClientMessage(giveplayerid, COLOR_GREY, string); return 1; } if(PlayerInfo[giveplayerid][pVehicle] == 0) { PlayerInfo[giveplayerid][pVehicle] = 1; format(string, sizeof(string), "* You set %s's car value to 1.", PlayerName(giveplayerid)); SendClientMessage(playerid, COLOR_LIGHTRED, string); format(string, sizeof(string), "* Admin %s set your car value to 1.", PlayerName(playerid)); SendClientMessage(giveplayerid, COLOR_GREY, string); return 1; } } else SendClientMessage(playerid, COLOR_GREY, "* User is not connected !");//======>this cant go here i think } return 1; } Код:
if(strcmp(cmdtext, "/fixcar", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "* Usuage: /fixcar [Player ID/part of name]"); return 1; } print("Before giveplayerid returnuser"); giveplayerid = ReturnUser(tmp); print("After giveplayerid return user"); if(IsPlayerConnected(giveplayerid)) { if(PlayerInfo[playerid][pAdmin] >= 99999) { if(PlayerInfo[giveplayerid][pVehicle] == 1) { PlayerInfo[giveplayerid][pVehicle] = 0; format(string, sizeof(string), "* You set %s's car value to 0.", PlayerName(giveplayerid)); SendClientMessage(playerid, COLOR_LIGHTRED, string); format(string, sizeof(string), "* Admin %s set your car value to 0.", PlayerName(playerid)); SendClientMessage(giveplayerid, COLOR_GREY, string); return 1; } if(PlayerInfo[giveplayerid][pVehicle] == 0) { PlayerInfo[giveplayerid][pVehicle] = 1; format(string, sizeof(string), "* You set %s's car value to 1.", PlayerName(giveplayerid)); SendClientMessage(playerid, COLOR_LIGHTRED, string); format(string, sizeof(string), "* Admin %s set your car value to 1.", PlayerName(playerid)); SendClientMessage(giveplayerid, COLOR_GREY, string); return 1; } } else return SendClientMessage(playerid, COLOR_GREY, "* you are not lvl 99999 admin !"); } else return SendClientMessage(playerid, COLOR_GREY, "* player not connected !"); //return 1; } |
if(strcmp(cmdtext, "/fixcar", true, 7) == 0) // or cmd and delete 7, if not cmdtext
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /fixcar [Player ID/part of name]");
print("Before giveplayerid returnuser");
giveplayerid = ReturnUser(tmp);
print("After giveplayerid return user");
if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[playerid][pAdmin] >= 99999)
{
new value = (PlayerInfo[giveplayerid][pVehicle] == 1) ? 0 : 1;
format(string, sizeof(string), "* You set %s's car value to %d.",PlayerName(giveplayerid),value);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "* Admin %s set your car value to %d.",PlayerName(playerid),value);
SendClientMessage(giveplayerid, COLOR_GREY, string);
PlayerInfo[giveplayerid][pVehicle] = value;
}
}else SendClientMessage(playerid, COLOR_GREY, "* User is not connected !");
return 1;
}