Jump to content
  • 0

Cum pun timer la o comanda?


Question

Posted

Deci am incercat sa pun timer la o comanda pentru a nu se putea folosi in creeare de bug-uri.

Comanda:

 else if(strcmp(x_nr,"locate",true) == 0)
	        {
	 		    if(!IsPlayerConnected(playerid)) { return 1; }
	 			if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
   				{
   				    SendClientMessage(playerid, COLOR_GREY, "   On a mission right now, can't use this command !");
				    return 1;
				}
			    new Float:x,Float:y,Float:z;
			    new car = PlayerInfo[playerid][pPcarkey];
			    if(PlayerInfo[playerid][pPcarkey]==999) { GameTextForPlayer(playerid, "~w~You do not have a car to locate", 2500, 3); return 1; }
				SendClientMessage(playerid,COLOR_WHITE,"Car location is at red marker on a map");
				GetVehiclePos(car, x, y, z);
			    SetPlayerCheckpoint(playerid, x, y, z, 6);
			    return 1;
	        }

Am incercat sa folosesc explicatia lui stuntman ( daca nu ma insel ) la un topic:

stuntman[]!" post="69915" timestamp="1304180091"]

La inceputul comenzii pui:

[pawn]if( GetPVarInt(playerid, "ICanUseFirstCommand") == 1 ) return SendClientMessage(playerid, -1, "Poti sa folosesti aceasta comanda doar o data pe minut !");

SetPVarInt(playerid, "ICanUseFirstCommand", 1);

SetTimerEx("CanUseCommand", 60000 /*timpul in care nu poate folosi comanda din nou*/, 0, "i",  playerid);

[/pawn]

Undeva in script:

[pawn]forward CanUseCommand(playerid);

public CanUseCommand(playerid)

{

SendClientMessage(playerid, -1, "Acum poti folosi comanda NUME_COMANDA_LA_CARE_A_FOST_FOLOSIT_ASTA !");

SetPVarInt(playerid, "ICanUseFirstCommand", 0);

return 1;

}[/pawn]

Dar nu a functionat mi-a dat warning la CanUseCommand. Dupa aceea am intrat pe wiki samp ( http://wiki.sa-mp.com/wiki/SetTimer ) Am incercat diferite moduri cum sa pun timerul, dar nu prea inteleg.. Stiu engleza am 14 ani, si doresc sa devin scripter. Comanda e luata dintr-un GF EDIT, deoarece doresc sa imi fac sv de samp, dar nu prea le am cu scriptatul, incerc sa invat dar.. dureaza si cateodata nu merge. Stiu ca trebuia sa postez la probleme GF EDIT, dar e un topic prea mare si nu cred ca imi raspundea cineva.. Daca puteti sa imi explicati cam cum sa fac, as intelege mai mult. Daca nu dati-mi mura'n gura, si am sa incerc sa inteleg din comanda cam cum se face. Multumesc anticipat! Va pun in credite pe server.

3 answers to this question

Recommended Posts

Posted

[pawn] else if(strcmp(x_nr,"locate",true) == 0)

        {

    if(!IsPlayerConnected(playerid)) { return 1; }

if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))

  {

      SendClientMessage(playerid, COLOR_GREY, "  On a mission right now, can't use this command !");

    return 1;

}

    new Float:x,Float:y,Float:z;

    new car = PlayerInfo[playerid][pPcarkey];

    if(PlayerInfo[playerid][pPcarkey]==999) { GameTextForPlayer(playerid, "~w~You do not have a car to locate", 2500, 3); return 1; }

SendClientMessage(playerid,COLOR_WHITE,"Car location is at red marker on a map");  (addtimer/1000));

GetVehiclePos(car, x, y, z);

    SetPlayerCheckpoint(playerid, x, y, z, 6);

    return 1;

        }[/pawn]

P.S Nuj sigur daca merge eu doar incerc sa te ajut !

RPG.CRUCIATII.RO GO&ENJOY

Posted

@lautaru Iti multumesc ca ai incercat, dar e degeaba,mi-a dat niste erori:

D:\d\SVSAMP~1\samp03\GAMEMO~1\eGamer.pwn(19908) : warning 215: expression has no effect
D:\d\SVSAMP~1\samp03\GAMEMO~1\eGamer.pwn(19908) : error 001: expected token: ";", but found ")"
D:\d\SVSAMP~1\samp03\GAMEMO~1\eGamer.pwn(19908) : error 029: invalid expression, assumed zero
D:\d\SVSAMP~1\samp03\GAMEMO~1\eGamer.pwn(19908) : warning 215: expression has no effect

Erorile alea le-am rezolvat,erau doar niste greseli de scriere + niste chestii uitate prin script.. Dar nu merge, in joc poti folosi comanda de 1000 de ori.

@xxSPEEDYxx Am rupt site-urile alea in ultimele zile.. Nu am reusit. Ma poate ajuta cineva? Multumesc ca ati incercat.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.