18.12.2010, 00:55
Not a bad attempt; just a few errors to correct:
I've left comments on the stuff I have changed. Typing /rp as an admin level 5+ should now transform your vehicle into a black infernus!
pawn Код:
if(strcmp(cmd, "/rp", true) == 0)
{
//if(IsPlayerConnected(playerid)) < ---- this check isn't needed: we know the player is connected
// because he has just typed the command
//{
new Float:x, Float:y, Float:z, Float:Angle;
GetPlayerPos(playerid,x,y,z); // ideally you would use GetVehiclePos when a player is in a vehicle, but it's ok
GetPlayerFacingAngle(playerid,Angle); // same for this, GetVehicleZPos to find a vehicle rotation angle
if (PlayerInfo[playerid][pAdmin] >= 5)
{
//new car;
//car = strval(tmp); <--- I'm not sure where tmp comes from
//if(car == infernus)
//{
new currentveh;
currentveh = GetPlayerVehicleID(playerid);
DestroyVehicle(currentveh);
currentveh = CreateVehicle(411,x,y,z,Angle,0,0,3000); // create the new vehicle into the currentveh variable
PutPlayerInVehicle(playerid,currentveh,0); // put player into the new currentveh
SetVehicleZAngle(currentveh, Angle); // set the vehicle rotation
//}
}
//}
}