Part 2 of the 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: Part 2 of the Problem. (
/showthread.php?tid=285689)
Part 2 of the Problem. -
trapstar2020 - 25.09.2011
Код:
if(strcmp(cmdtext, "/vpi", true) == 0)
{
new string[128];
switch(gTeam[playerid])
{
case TEAM_Goldvip:
{
if((GetTickCount()-WaitTimeForCMD[playerid])>86400000)return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: Wait 24 Hours to use this CMD again!");
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,Float:x,Float:y,Float:z);
new car1[MAX_PLAYERS];
car1[playerid] = CreateVehicle(411,Float:x,Float:y,Float:z,100.0,1,1,10);
PutPlayerInVehicle(playerid,car1[playerid],0);
WaitTimeForCMD[playerid]=GetTickCount();
forward Autorepair(playerid);
public Autorepair(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:health,vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid,health);
if(health <250)
{
SetVehicleHealth(vehicleid,1000);
}
}
}
format(string,sizeof(string),"Platinum V.I.P. Invincible Car");
SendClientMessage(playerid,Platinum_vip_COLOUR,string);
}
}
return 1;
}
return 0;
}
When compiled
Код:
invalid expression, assumed zero
undefined symbol "Autorepair
invalid expression, assumed zero
undefined symbol "Autorepair
auto fix came from :
https://sampforum.blast.hk/showthread.php?tid=159239
Re: Part 2 of the Problem. -
=WoR=Varth - 25.09.2011
Why in the hell you put "Autorepair" callback inside "OnPlayerCommandText" callback?
I think that's not a good tutorial.
Re: Part 2 of the Problem. -
trapstar2020 - 25.09.2011
well can u help all i want is the car to autorepair when damage reach that amount for my vip.
I trying to make invincible cars for them
Re: Part 2 of the Problem. -
aRoach - 25.09.2011
pawn Код:
// In top of Script...
new InvTimer[ MAX_PLAYERS ];
if(strcmp(cmdtext, "/vpi", true) == 0)
{
new string[128];
switch(gTeam[playerid])
{
case TEAM_Goldvip:
{
if( ( GetTickCount( ) - WaitTimeForCMD[ playerid ] ) > 86400000 ) return SendClientMessage( playerid, 0xFFFFFFFF, "ERROR: Wait 24 Hours to use this CMD again!" );
new Float:x,Float:y,Float:z;
GetPlayerPos( playerid, x, y, z );
new car1[ MAX_PLAYERS ];
car1[ playerid ] = CreateVehicle(411,Float:x,Float:y,Float:z,100.0,1,1,10);
PutPlayerInVehicle( playerid, car1[ playerid ], 0 );
WaitTimeForCMD[ playerid ] = GetTickCount( );
InvTimer[ playerid ] = SetTimerEx( Autorepair, 1000, true );
}
format(string,sizeof(string),"Platinum V.I.P. Invincible Car");
SendClientMessage(playerid,Platinum_vip_COLOUR,string);
}
return 1;
}
forward Autorepair( playerid );
public Autorepair( playerid )
{
if( IsPlayerInAnyVehicle( playerid ) )
{
new
Float:health,
vehicleid = GetPlayerVehicleID( playerid )
;
GetVehicleHealth( vehicleid, health );
if( health < 999 ) RepairVehicle( vehicleid );
}
return ( 1 );
}