SA-MP Forums Archive
SetVehicleNumberPlate PROBLEM. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SetVehicleNumberPlate PROBLEM. (/showthread.php?tid=280991)



SetVehicleNumberPlate PROBLEM. - Shetch - 03.09.2011

This comand doesnt seem to be working.
Just respawns the car with some wierd letter as a plate if i type in numbers. But if i type in letters it just respawns the vehicle and leaves the default plate.

My command:
Код:
dcmd_plate(playerid,params[])
{
	new Vehicle, plate[MAX_PLAYERS];
    new tmp[256], Index;
	new Float:X,Float:Y,Float:Z;
    Vehicle = GetPlayerVehicleID(playerid);
    tmp = strtok(params,Index),plate[playerid] = strval(tmp);
    if(GetPlayerScore(playerid) < 5) return SendClientMessage(playerid, GREY, "ERROR: Љo kommandu var izmantot no 5. līmeņa.");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,GREY,"ERROR: Tev jāatrodas maљīnā lai izmantotu љo komandu.");
    if(IsDriver[playerid] == 0) return SendClientMessage(playerid,GREY,"ERROR: Tev jāatrodas pie stūres lai izmantotu љo komandu.");
    if(!strlen(params)) return SendClientMessage(playerid,GREY,"ERROR: /plate [Teksts]");
	SetVehicleNumberPlate(Vehicle,plate[playerid]);
    GetVehiclePos(Vehicle,Float:X,Float:Y,Float:Z);
    SetVehicleToRespawn(Vehicle);
    SetVehiclePos(Vehicle,Float:X,Float:Y,Float:Z);
    PutPlayerInVehicle(playerid,Vehicle,0);
	return 1;
}



Re: SetVehicleNumberPlate PROBLEM. - FireCat - 03.09.2011

Quote:
Originally Posted by Shetch
Посмотреть сообщение
This comand doesnt seem to be working.
Just respawns the car with some wierd letter as a plate if i type in numbers. But if i type in letters it just respawns the vehicle and leaves the default plate.

My command:
Код:
dcmd_plate(playerid,params[])
{
	new Vehicle, plate[MAX_PLAYERS];
    new tmp[256], Index;
	new Float:X,Float:Y,Float:Z;
    Vehicle = GetPlayerVehicleID(playerid);
    tmp = strtok(params,Index),plate[playerid] = strval(tmp);
    if(GetPlayerScore(playerid) < 5) return SendClientMessage(playerid, GREY, "ERROR: Љo kommandu var izmantot no 5. līmeņa.");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,GREY,"ERROR: Tev jāatrodas maљīnā lai izmantotu љo komandu.");
    if(IsDriver[playerid] == 0) return SendClientMessage(playerid,GREY,"ERROR: Tev jāatrodas pie stūres lai izmantotu љo komandu.");
    if(!strlen(params)) return SendClientMessage(playerid,GREY,"ERROR: /plate [Teksts]");
	SetVehicleNumberPlate(Vehicle,plate[playerid]);
    GetVehiclePos(Vehicle,Float:X,Float:Y,Float:Z);
    SetVehicleToRespawn(Vehicle);
    SetVehiclePos(Vehicle,Float:X,Float:Y,Float:Z);
    PutPlayerInVehicle(playerid,Vehicle,0);
	return 1;
}
pawn Код:
dcmd_plate(playerid,params[])
{
    new Vehicle, plate[MAX_PLAYERS];
    new tmp[256], Index;
    new Float:X,Float:Y,Float:Z;
    Vehicle = GetPlayerVehicleID(playerid);
    tmp = strtok(params,Index);
    format(plate[playerid],128,"%s",tmp);
    if(GetPlayerScore(playerid) < 5) return SendClientMessage(playerid, GREY, "ERROR: Љo kommandu var izmantot no 5. līmeņa.");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,GREY,"ERROR: Tev jāatrodas maљīnā lai izmantotu љo komandu.");
    if(IsDriver[playerid] == 0) return SendClientMessage(playerid,GREY,"ERROR: Tev jāatrodas pie stūres lai izmantotu љo komandu.");
    if(!strlen(params)) return SendClientMessage(playerid,GREY,"ERROR: /plate [Teksts]");
    SetVehicleNumberPlate(Vehicle,plate[playerid]);
    GetVehiclePos(Vehicle,Float:X,Float:Y,Float:Z);
    SetVehicleToRespawn(Vehicle);
    SetVehiclePos(Vehicle,Float:X,Float:Y,Float:Z);
    PutPlayerInVehicle(playerid,Vehicle,0);
    return 1;
}



Re: SetVehicleNumberPlate PROBLEM. - Vince - 03.09.2011

What the hell is this supposed to be doing?
pawn Код:
tmp = strtok(params,Index),plate[playerid] = strval(tmp);
This is dcmd, not some lousy strcmp.


Re: SetVehicleNumberPlate PROBLEM. - Shetch - 03.09.2011

Thanks, +reputation.


Quote:
Originally Posted by Vince
Посмотреть сообщение
What the hell is this supposed to be doing?
pawn Код:
tmp = strtok(params,Index),plate[playerid] = strval(tmp);
This is dcmd, not some lousy strcmp.
i dont need that?


Re: SetVehicleNumberPlate PROBLEM. - FireCat - 03.09.2011

Oh lol it's dcmd.
pawn Код:
dcmd_plate(playerid,params[])
{
    new Vehicle, plate[MAX_PLAYERS];
    new Float:X,Float:Y,Float:Z;
    Vehicle = GetPlayerVehicleID(playerid);
    format(plate[playerid],128,"%s",params);
    if(GetPlayerScore(playerid) < 5) return SendClientMessage(playerid, GREY, "ERROR: Šo kommandu var izmantot no 5. līmeņa.");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,GREY,"ERROR: Tev jāatrodas mašīnā lai izmantotu šo komandu.");
    if(IsDriver[playerid] == 0) return SendClientMessage(playerid,GREY,"ERROR: Tev jāatrodas pie stūres lai izmantotu šo komandu.");
    if(!strlen(params)) return SendClientMessage(playerid,GREY,"ERROR: /plate [Teksts]");
    SetVehicleNumberPlate(Vehicle,plate[playerid]);
    GetVehiclePos(Vehicle,Float:X,Float:Y,Float:Z);
    SetVehicleToRespawn(Vehicle);
    SetVehiclePos(Vehicle,Float:X,Float:Y,Float:Z);
    PutPlayerInVehicle(playerid,Vehicle,0);
    return 1;
}
Rep?