07.12.2010, 15:38
Hey folks! Got a problem, search button is so unuseful -.-
Here's the code:
Any solutions? In the same cmd, theres the same error, BTW the error occurs on line: x_nr = strtok(cmdtext, idx);
How could I fix it? It works fine in some places, some places not.
Here's the code:
pawn Код:
if(strcmp(cmd, "/v", true) == 0 || strcmp(cmd, "/vehicle", true) == 0) // By Ellis
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " Pead enne sisse logima ! ");
return 1;
}
new x_nr[64];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, "NIPP: (/v)ehicle [nimi]");
SendClientMessage(playerid, COLOR_WHITE, "Saadaval nimed: pargi, lukusta(1-3), mьь, sellto, vдrv");
return 1;
}
if(strcmp(x_nr,"mьь",true) == 0)
{
if(IsAtDealership(playerid))
{
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3])
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new ownvehkey;
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { ownvehkey = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { ownvehkey = PlayerInfo[playerid][pPcarkey2]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { ownvehkey = PlayerInfo[playerid][pPcarkey3]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey4]) { ownvehkey = PlayerInfo[playerid][pPcarkey4]; }
else { return 1; }
if(strcmp(sendername, CarInfo[ownvehkey][cOwner], true) == 0)
{
new carsellprice = CarInfo[ownvehkey][cValue] / 4 * 3;
new Float:x,Float:y,Float:z;
new Float:a;
CarInfo[ownvehkey][cOwned] = 0;
//strmid(CarInfo[ownvehkey][cOwner], "Dealership", 0, strlen("Dealership"), 999);
SafeGivePlayerMoney(playerid,carsellprice);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~myysid oma auto: ~n~~g~$%d eest", carsellprice);
GameTextForPlayer(playerid, string, 10000, 3);
GetVehiclePos(ownvehkey, x, y, z);
GetVehicleZAngle(ownvehkey, a);
CarInfo[ownvehkey][cLocationx] = x;
CarInfo[ownvehkey][cLocationy] = y;
CarInfo[ownvehkey][cLocationz] = z;
CarInfo[ownvehkey][cAngle] = a;
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { PlayerInfo[playerid][pPcarkey] = 999; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { PlayerInfo[playerid][pPcarkey2] = 999; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { PlayerInfo[playerid][pPcarkey3] = 999; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey4]) { PlayerInfo[playerid][pPcarkey4] = 999; }
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
if(PlayerInfo[playerid][pLocal] == ownvehkey)
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,CarInfo[ownvehkey][cLocationx],CarInfo[ownvehkey][cLocationy],CarInfo[ownvehkey][cLocationz]);
PlayerInfo[playerid][pInt] = 0;
}
OnPropUpdate();
OnPlayerUpdate(playerid);
DestroyVehicle(ownvehkey);
CreateVehicle(CarInfo[ownvehkey][cModel],CarInfo[ownvehkey][cLocationx],CarInfo[ownvehkey][cLocationy],CarInfo[ownvehkey][cLocationz]+1.0,CarInfo[ownvehkey][cAngle],CarInfo[ownvehkey][cColorOne],CarInfo[ownvehkey][cColorTwo],60000);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Pead istuma oma autos et seda mььa! ");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Sa pole mььgikohas");
return 1;
}
}
How could I fix it? It works fine in some places, some places not.