[HELP] Car Spawn
#1

Hi, I would like create a car spawner with pawno and with the function of fix, but I'm a begginer and I don't know where to start please can you help me? (I have gta samp 0.3b)
Reply
#2

for spawning vehicle this:
if(strcmp(cmd, "/veh", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] < 6)
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
return 1;
}
new car;
car = strval(tmp);
if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GREY, " Vehicle Number can't be below 400 or above 611 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < -1 || color1 > 126) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 126 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
return 1;
}
if(car == 520) Hydras ++;
if(car == 425) Hunters ++;
if(car == 430) Predators ++;
if(car == 432) Rhinos ++;
new color2;
color2 = strval(tmp);
if(color2 < -1 || color2 > 126) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 126 !"); return 1; }
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);

new Float:Angle;
GetPlayerFacingAngle(playerid, Angle);

new carid = CreateVehicle(car, X,Y,Z, Angle, color1, color2, 60000);
createdcar[carid] = carid;
engineOn[carid] = true;
LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playerid, carid, 0);
format(string, sizeof(string), "** Vehicle %d spawned.", carid);
SendClientMessage(playerid, COLOR_GREY, string);
new housename[24]; GetVehicleName(carid, housename, sizeof(housename));
new area[36]; GetPlayer2DZone(playerid, area, sizeof(area));
format(string,sizeof(string), "[ADMIN]: %s Has Spawned a %s (%d) [%d] At His Position (%s).",sendername,housename,car,carid,area);
ABroadCast(COLOR_LIGHTRED, string, 5);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Spawned a %s (%d) [%d] (Color 1: %d | Color 2: %d) At His Position.",d,m,y,h,mi,s,sendername,housename,car,c arid,color1,color2);
AdminLog(string);
}
return 1;
}




For fixing vehicle this:

if(strcmp(cmd, "/vr", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 1337)
{
SendClientMessage(playerid, COLOR_GRAD1, "** you are not authorized to use that command!");
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, COLOR_GREY, "** Vehicle Fixed !");
format(string, sizeof(string), "[ADMIN]: %s has Fixed His Car", sendername);
ABroadCast(COLOR_LIGHTRED, string, 5);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Repaired His Vehicle.",d,m,y,h,mi,s,sendername);
AdminLog(string);
}
}
return 1;
}
Reply
#3

Do you have a gamemode or filterscript for the cars, or are you trying to make a streamer of some sort?
Reply
#4

@ Mehtab: Im sure he doesn't know much about Adminlog and Mysql.

For repair, just use this:
pawn Код:
CMD:fix(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid))
    {
        SendClientMessage(playerid, COLOR_RED, "[Error]: You must be in a vehicle.");
        return true;
    }

    vehicleID = GetPlayerVehicleID(playerid);
    RepairVehicle(vehicleID);
    return true;
}
Reply
#5

@FrehDoubleX i don't know he have MySQL or not. I am giving a beginner command. If he down't have MySQL pluging then he will get error
Reply
#6

Thanks but this command go in to pawno? And the car spawn is a menu or command?
Reply
#7

Quote:
Originally Posted by dbucci
Посмотреть сообщение
Thanks but this command go in to pawno? And the car spawn is a menu or command?
OMG HAHAHAH....... sry about that... i knw u r a starter and i shouldnt laugh....
yes it goes into pawno under OnPlayerCommandText... and it is a car spawning command...
Reply
#8

Sorry if I replied late, but when I go to finalize the car spawn, windows tells me that the pawn compiler library has stopped working. Please help me.
Reply
#9

C:\Documents and Settings\Miki\Pulpit\Nowy folder\filterscripts\gh.pwn(95) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\Miki\Pulpit\Nowy folder\filterscripts\gh.pwn(95) : warning 215: expression has no effect
C:\Documents and Settings\Miki\Pulpit\Nowy folder\filterscripts\gh.pwn(95) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Miki\Pulpit\Nowy folder\filterscripts\gh.pwn(95) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Miki\Pulpit\Nowy folder\filterscripts\gh.pwn(95) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Pls help
Reply
#10

:/ :O :O
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)