Jump to content
  • 0

intrebare sscanf2...


xxSPEEDYxx

Question

Sall

Am o intrebare despre sscanf...

deci dau un ex...este o functie asemanatoare:

if(GetPlayerMoney(playerid) >= CarInfo[i][cValue])
						{
	}
						else
						{
							SendClientMessage(playerid, GREY, "   You don't have the cash for that!");
							return 1;
						}
si as vrea sa pun asa:
if(sscanf(params, "ud", GetPlayerMoney(playerid) >= CarInfo[i][cValue])) return SendClientMessage(playerid, GREY, "   You don't have the cash for that!");

daca se poate??

Fara reclama in semnatura!

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

Nu poti pune

if(sscanf(params, "ud", GetPlayerMoney(playerid) >= CarInfo[i][cValue])) return SendClientMessage(playerid, GREY, "   You don't have the cash for that!");
dar in schimb poti pune
if( sscanf( params, "ud", params[ 0 ], params[ 1 ] ) ) return SendClientMessage(playerid, GREY, "USAGE: < /comanda [parametrii] >");
if( GetPlayerMoney(playerid) >= CarInfo[i][cValue] ) ) return SendClientMessage(playerid, GREY, "   You don't have the cash for that!");

Link to comment
Share on other sites

stuntman-=!!" post="79634" timestamp="1308929231"]

Nu poti pune

if(sscanf(params, "ud", GetPlayerMoney(playerid) >= CarInfo[i][cValue])) return SendClientMessage(playerid, GREY, "   You don't have the cash for that!");
dar in schimb poti pune
if( sscanf( params, "ud", params[ 0 ], params[ 1 ] ) ) return SendClientMessage(playerid, GREY, "USAGE: < /comanda [parametrii] >");
if( GetPlayerMoney(playerid) >= CarInfo[i][cValue] ) ) return SendClientMessage(playerid, GREY, "   You don't have the cash for that!");

da dc asa?

Fara reclama in semnatura!

Link to comment
Share on other sites

ca sa nu mai fac alt topic cu sscanf...postez in asta:

am o alta intrebare daca se poate pune asa in sscanf sa verifice o variabila de ex:

if( sscanf(params, "ud", InEvent[playerid] == 1 )) return SendClientMessage(playerid,0xFFFFFFAA,"You can not use jetpack at the event!");

?

Fara reclama in semnatura!

Link to comment
Share on other sites

Guest RockStar

if( sscanf(params, "ud", InEvent[playerid] == 1 )) return SendClientMessage(playerid,0xFFFFFFAA,"You can not use jetpack at the event!");

Codu ala nu are niciun inteles..."ud" semnifica: u = playerid, d = string si...."InEvent[playerid] == 1"....????

Si nu cred ca se poate.

Link to comment
Share on other sites

sscanf e folosit doar pentru a pune usage, si pentru a formata un string, sau asa ceva, params sa devina params[ 0 ], params[ 1 ], etc., sa se faca string, numar, nu sa verifice toate porcariile.

Pentru aia pui asa:

if( sscanf( params, "ud", params[ 0 ], params[ 1 ] ) ) return SendClientMessage(playerid,0xFFFFFFAA,"USAGE: < /comanda [parametrii]");
if( InEvent[ playerid ] == 1 ) return SendClientMessage(playerid,0xFFFFFFAA,"You can not use jetpack at the event!"); 

EDIT: Rock, d = decimal = cifra.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Similar Content

    • By GamerulFOX
      Salut ! Am o intrebare ! Am vazut ca o parte din persoanele care compileaza un gamemode le apar asa : https://imgur.com/a/MwK4kbW ! Dar eu cand compilez imi apare asa: https://imgur.com/a/1Q2i5AR ! Cum pot sa fac sa imi apara si mie ca in prima poza ?
    • By GamerulFOX
      Salut ! Am o intrebare ! Daca vreau sa folosesc dini pentru server-ul meu de samp, care sunt niste comenzi care m-ar ajuta ? Adica de ex un bonus ! Daca vreau sa dau /bonus sa se puna bonus in "Baza de date" de la dini sa se puna pe unu
    • By Smokie1
      Deci, eu am un server de samp, eu imi pot creea conturi pe server dar alti nu is pot face cont, ma puteti ajuta sa imi spuneti motivul ? Va rog frumos !
    • By salexm93
      Salutare 
      Poate nu inteleg eu bine , pe wiki scrie max 2048 globale si 256 per player .
      Sa luam cazul ipotetic al unui server cu 1000 de playeri online .
      new Text:xpbar[MAX_PLAYERS]; new Text:playername[MAX_PLAYERS]; Aici vor fi 2000 create ? Adica destul de aproape de limita
       
      new PlayerText:xpbar[MAX_PLAYERS]; new PlayerText:playername[MAX_PLAYERS]; Iar Aici vor fi doar 2 ?
      Totodata , PlayerTextDrawDestroy ,la onplayerdisconnect ?
    • By GamerulFOX
      CMD:heal(playerid, params[])
      {
          new id, hp, Float:viata, Float:viata2, string[256], string2[256], name1[MAX_PLAYER_NAME], viata3[MAX_PLAYERS], name[MAX_PLAYER_NAME];
          GetPlayerName(playerid, name, sizeof(name));
          if(fMedic[playerid] == 0) return SendClientMessage(playerid, 0xff0000FF, "Nu faci parte din factiunea 'Medic' !");
          if(sscanf(params, "ud", id, hp)) return SendClientMessage(playerid, 0x00aeffFF, "/healp <playerid/name> <amount>");
          if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SCM(playerid, 0xff0000FF, "Acel jucator nu este conectat!");
          GetPlayerName(id, name1, sizeof(name1));
          GetPlayerHealth(id, viata);
          new Float:x, Float:y, Float:z;
          GetPlayerPos(id, x, y, z);
          if(!IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z)) return SendClientMessage(playerid, 0xff0000FF, "Nu esti langa acel player!");
          if(GetPlayerMoney(id) < hp*2) return SendClientMessage(playerid, 0xff0000FF, "Acel jucator nu are suficienti lei, pentru acel hp!");
          viata3[playerid] = GetPlayerHealth(id, viata2);
          if(viata3[playerid] >= 100) return SendClientMessage(playerid, 0xff0000FF, "Acel jucator are deja viata maxima!");
          format(string, sizeof(string), "Iai oferit lui %s %d heal!", name1, hp);
          SendClientMessage(playerid, 0x00aeffFF, string);
          format(string2, sizeof(string2), "Medicul %s ti-a oferit %d heal, iar tu l-ai platit!", name, hp);
          SendClientMessage(id, 0x00aeffFF, string2);
          new pay[MAX_PLAYERS];
          pay[playerid] = hp*3;
          GivePlayerMoney(id, -pay[playerid]);
          GivePlayerMoney(playerid, hp * 2);
          SetPlayerHealth(id, viata+hp);
          return 1;
      }
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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.