Quote:
Originally Posted by Rufio
He says there are no errors, read the whole script and you can see the mistakes.
I have seen a few of them, don't have enough time to check them all out though. Here is my assumptions of how it should work;
pawn Код:
dcmd_Createpv(playerid, params[]) { new cmd[256],id, lvla, scelta, lvla2, cmd2[256], scelta2; //if(PlayerInfo[playerid][gangid] ==0) return SendClientMessage(playerid,COLORE_ROSSO,"ERROR:You are not in any gang."); cmd = strtok(params, scelta); cmd2 = strtok(params, scelta2); if (!strlen(cmd))return SendClientMessage(playerid,COLORE_ROSSO, "Use: /Createpv [playerid] [vehicleid] [vehiclecolor]."); if (!strlen(cmd2))return SendClientMessage(playerid,COLORE_ROSSO, "Use: /Createpv [playerid] [vehicleid] [vehiclecolor]."); //if (!strlen(cmd2))return SendClientMessage(playerid,COLORE_ROSSO, "Use: /Createpv [playerid] [vehicleid] [vehiclecolor]."); id = strval(cmd); id = strval(cmd2); if(!IsPlayerConnected(id)) { SendClientMessage(playerid,COLORE_ROSSO, "ERROR:The player is not connect."); } // I've removed return 1 because it was completely unnecessary and wrong, you don't need to put return 1 after each if statement. else // I've put an else here, seeing as there were no callbacks to be called here. { cmd = strtok(params, scelta); if (!strlen(cmd)) { SendClientMessage(playerid,COLORE_ROSSO, "Use: /Createpv [playerid] [vehicleid] [vehiclecolor]."); } lvla = strval(cmd); if(lvla < 400 || lvla > 611) { SendClientMessage(playerid,COLORE_ROSSO, "ERROR: Invald vehicle id."); } cmd2 = strtok(params, scelta2); if (!strlen(cmd2)) { SendClientMessage(playerid,COLORE_ROSSO, "Use: /Createpv [playerid] [vehicleid] [vehiclecolor]."); } lvla2 = strval(cmd2); if(lvla2 < 0 || lvla2 > 255) { SendClientMessage(playerid,COLORE_ROSSO, "ERROR: Invald vehicle color."); } PlayerInfo[id][PrivateCar] = lvla; PlayerInfo[id][CarColor] = lvla2; SendClientMessage(playerid,COLORE_VERDE,"Successfully."); } return 1; }
This should work like a charm if you haven't done any other script mistakes, if it doesn't then i will look for your script mistakes, you'll have to tell me what exactly you want this script to do though.
|
If i type /createpv [id] [carid] and not [carcolor] the cmd send this message
[13:07:23] ERROR: Invald vehicle color.
[13:07:23] Successfully.
If i type /createpv [id] and not [carid] [carcolor] the cmd send this message
[13:07:05] Use: /Createpv [playerid] [vehicleid] [vehiclecolor].
[13:07:05] ERROR: Invald vehicle id.
[13:07:05] Use: /Createpv [playerid] [vehicleid] [vehiclecolor].
[13:07:05] Successfully.
If i type /createpv [id] [carid] [carcolor] with all correct, the cmd send this message
[13:07:29] ERROR: Invald vehicle color.
[13:07:29] Successfully.
And wrong to set carcolor, it always set to 0 like if i don't put the carcolor