/stunt command.
#1

Hello, i have problem with /stunt command,
then player types: /stunt 99999999999999999999999999999999
server crashes, how to fix this?



Код:
dcmd_stunt(playerid, params[])
{
  //print("dcmd_stunt");
  if(PlayerInfo[playerid][pKova] == 1 || PlayerInfo[playerid][pDerby] == 1 || PlayerInfo[playerid][pSKY] == 1 || PlayerInfo[playerid][pFUN] == 1 || PlayerInfo[playerid][pCBUG] == 1 || RaceParticipant[playerid]>0 || dragParticipant[playerid]>0 || MaratonasParticipant[playerid]>0) return naudokplayer(playerid);
  //if(PlayerInfo[playerid][pLogged] == 0) return prisijunk(playerid);
	new req[32];
	if(sscanf(params, "s", req))
	{
  if(PlayerInfo[playerid][pSTUNT] >= 1) return STUNT_zonos(playerid);
  if(PlayerInfo[playerid][pSTUNT2] >= 1) return STUNT2_zonos(playerid);
  switch (PlayerInfo[playerid][pKalba]){
  case 0:GameTextForPlayer(playerid,"~r~Stunt:~n~~n~~w~/stunt 1 - 2",5000,3);
  case 1:GameTextForPlayer(playerid,"~r~Stuntai:~n~~n~~w~/stuntas 1 - 2",5000,3);}
	return true;
	}
//==============================================================================
  if(strcmp(req, "1", true) == 0)
	{
  if(PlayerInfo[playerid][pSTUNT] >= 1) return STUNT_zonos(playerid);
  if(PlayerInfo[playerid][pSTUNT2] >= 1) return STUNT2_zonos(playerid);
  prisijungtistunt(playerid);
	}
//==============================================================================
  if(strcmp(req, "2", true) == 0)
	{
  if(PlayerInfo[playerid][pSTUNT] >= 1) return STUNT_zonos(playerid);
  if(PlayerInfo[playerid][pSTUNT2] >= 1) return STUNT2_zonos(playerid);
  if(PlayerInfo[playerid][pSTUNTLaimeta] < 1){
  switch (PlayerInfo[playerid][pKalba]){
  case 0:SendClientMessage(playerid, COLOR_INFO,"INFO: You have to finish /stunt 1 first.");
  case 1:SendClientMessage(playerid, COLOR_INFO,"INFO: Tu turi бveikti /stunt 1 pirmiausia.");
	}
	return 1;
	}
  prisijungtistunt2(playerid);
	}
//==============================================================================
	else
	{
  if(PlayerInfo[playerid][pSTUNT] >= 1) return STUNT_zonos(playerid);
  if(PlayerInfo[playerid][pSTUNT2] >= 1) return STUNT2_zonos(playerid);
  switch (PlayerInfo[playerid][pKalba]){
  case 0:GameTextForPlayer(playerid,"~r~Stunt:~n~~n~~w~/stunt 1 - 2",5000,3);
  case 1:GameTextForPlayer(playerid,"~r~Stuntai:~n~~n~~w~/stuntas 1 - 2",5000,3);}
	}
 	return true;
}
Reply
#2

pawn Код:
if(cmdtext < 0 || cmdtext > 2)
Reply
#3

Quote:
Originally Posted by cοοp
pawn Код:
if(cmdtext < 0 || cmdtext > 2)
?
Reply
#4

pawn Код:
if(cmdtext < 0 || idx > 2)
{
SendClientMessage(playerid, 0xFF0000AA, "[ERROR]: Invalid stunt.");
return 1;
}
Add that to your command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)