SA-MP Forums Archive
I need help, please!! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: I need help, please!! (/showthread.php?tid=99610)

Pages: 1 2


Re: I need help, please!! - Pinehole - 29.09.2009

Yeah but i tried adding it, didn't seem to work, can you show me how please?


Re: I need help, please!! - Correlli - 29.09.2009

Quote:
Originally Posted by Pinehole
Yeah but i tried adding it, didn't seem to work, can you show me how please?
There's an example in the both links i gave you.


Re: I need help, please!! - Pinehole - 29.09.2009

Ughh, but what's the difference between AddStaticPickup, and createpickup?


Re: I need help, please!! - Correlli - 29.09.2009

CreatePickup can be created at anytime while AddStaticPickup can only be added at OnGameModeInit callback and CreatePickup returns the id of the pickup while AddStaticPickup doesn't.


Re: I need help, please!! - Pinehole - 29.09.2009

Thanks, you helped me alot, but is this right?

Код:
// PICK UPS
	CreateObject(1239,1366.0443,-1274.7583,13.5469,273.1494);



Re: I need help, please!! - ded - 29.09.2009

No .. CreateObject is completely different to CreateObject. CreatePickup.


Re: I need help, please!! - Pinehole - 29.09.2009

CreateObject is different from CreateObject lol? anyways is this correct, can you tell me what i have done wrong, cause when ever i type /gundealer my server crashes. it's a filterscript, anything i need to put in my gamemode? help me please.

Код:
	new tmp[256];
				new string[256];
				new sendername[MAX_PLAYER_NAME];
				new giveplayer[MAX_PLAYER_NAME];
				new cmd[256];
 				new idx;
  			new giveplayerid;
				cmd = strtok(cmdtext, idx);

				if(strcmp(cmd, "/gundealer", true) == 0) {
	   	  if (GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,1366.4325,-1275.2096,13.5469))
	gTeam[playerid] = TEAM_GUNDEALER;
  	SendClientMessage(playerid, COLOR_YELLOW, "Make Sure you are near Ammunation Door, to become an Arms Dealer");
  	  	  // PICK UPS
	CreateObject(1239,1366.0443,-1274.7583,13.5469,273.1494,-1);
	return 1;
	}

				if(strcmp(cmd, "/sellmolotov", true) == 0) {

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            		SendClientMessage(playerid, COLOR_YELLOW, "Usage: /sellgunm4");
								return 1;
        }
				giveplayerid = strval(tmp);

  			if (IsPlayerConnected(giveplayerid)) {
    if (gTeam[playerid] == TEAM_GUNDEALER) {
  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  GetPlayerName(playerid, sendername, sizeof(sendername));
  GivePlayerWeapon(giveplayerid, 18, 5);
  GivePlayerMoney(playerid, 2000);
  GivePlayerMoney(giveplayerid, -2000);
  format(string, sizeof(string), "You have sold 5 molotovs", sendername, playerid);
  SendClientMessage(giveplayerid, COLOR_YELLOW, string);
  format(string, sizeof(string), "%s gave you 5 molotovs", giveplayer, giveplayerid, sendername, playerid);
  return 1;
      }else{
        				SendClientMessage(playerid, COLOR_RED1, "You Are not official Gundealer.");
}
            }else{
    format(string, sizeof(string), "id %d is not an active player.", giveplayerid);
		SendClientMessage(playerid, COLOR_YELLOW, string);
}
				return 1;
}


				if(strcmp(cmd, "/sellgunmp5", true) == 0) {

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            		SendClientMessage(playerid, COLOR_YELLOW, "Usage: /sellmp5 [id]");
								return 1;
        }
				giveplayerid = strval(tmp);

  			if (IsPlayerConnected(giveplayerid)) {
    if (gTeam[playerid] == TEAM_GUNDEALER) {
  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  GetPlayerName(playerid, sendername, sizeof(sendername));
  GivePlayerWeapon(giveplayerid, 29, 65000);
  GivePlayerMoney(playerid, 3000);
  GivePlayerMoney(giveplayerid, -3000);
  format(string, sizeof(string), "You have sold an Mp5 to %s", sendername, playerid);
  SendClientMessage(giveplayerid, COLOR_GREY, string);
  format(string, sizeof(string), "%s Has Sold you an Mp5", sendername, playerid, sendername, playerid);
  return 1;
      }else{
        				SendClientMessage(playerid, COLOR_RED1, "You Are not official Gundealer.");
}
            }else{
    format(string, sizeof(string), "id %d is not an active player.", giveplayerid);
		SendClientMessage(playerid, COLOR_YELLOW, string);
}
				return 1;
}


				if(strcmp(cmd, "/sellgunspas12", true) == 0) {

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            		SendClientMessage(playerid, COLOR_YELLOW, "Usage: /sellspas12 [ID]");
								return 1;
        }
				giveplayerid = strval(tmp);

  			if (IsPlayerConnected(giveplayerid)) {
    if (gTeam[playerid] == TEAM_GUNDEALER) {
  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  GetPlayerName(playerid, sendername, sizeof(sendername));
  GivePlayerWeapon(giveplayerid, 27, 65000);
  GivePlayerMoney(playerid, 1000);
  GivePlayerMoney(giveplayerid, -1000);
  format(string, sizeof(string), "You have sold an Spas12 to %s", sendername, playerid);
  SendClientMessage(giveplayerid, COLOR_GREY, string);
  format(string, sizeof(string), "%s Has sold you an Spas12", giveplayer, giveplayerid, sendername, playerid);
  return 1;
      }else{
        				SendClientMessage(playerid, COLOR_RED1, "You arent a Gundealer.");
}
            }else{
    format(string, sizeof(string), "id %d is not connected.", giveplayerid);
		SendClientMessage(playerid, COLOR_YELLOW, string);
}
				return 1;
}

        return 0;
}
public Float:GetDistanceBetweenPlayers(p1,p2){
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2)){
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x2,y2,z2);
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));

}



Re: I need help, please!! - ded - 29.09.2009

Sorry I meant CreateObject is different to CreatePickup .. my bad.


Re: I need help, please!! - Correlli - 29.09.2009

You can use pickup, not object. And learn not to use 256 because you don't need that much cells, 128 is enough.


Re: I need help, please!! - Pinehole - 29.09.2009

256 where? can you tell me where i make mistakes, cause i dont seem to understand


Re: I need help, please!! - ded - 30.09.2009

Why do I get errors then? O_o

I tried changing them all to 128 once ... that was a bad day for me because I had to change them all back to 256 ..

Edit: I'm in the middle of re-writing my whole gamemode for 0.3. Optimizing it alot, there were alot of 256 strings in my 0.2x edition (which was even then, still considerably in beta), so believe me when I say I get these errors all the time. Just tried right now:

pawn Код:
error 047: array sizes do not match, or destination array is too small



Re: I need help, please!! - Correlli - 30.09.2009

Quote:
Originally Posted by » Pawnst★r «
Why do I get errors then? O_o

I tried changing them all to 128 once ... that was a bad day for me because I had to change them all back to 256 ..
Were you maybe using DINI/DUDB system? Their functions always returns MAX_STRING which is 256.


Re: I need help, please!! - ded - 30.09.2009

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by » Pawnst★r «
Why do I get errors then? O_o

I tried changing them all to 128 once ... that was a bad day for me because I had to change them all back to 256 ..
Were you maybe using DINI/DUDB system? Their functions always returns MAX_STRING which is 256.
I am actually. How is this solved then? O_o


Re: I need help, please!! - Correlli - 30.09.2009

RE-define MAX_STRING as 128.


Re: I need help, please!! - ded - 30.09.2009

Quote:
Originally Posted by Don Correlli
RE-define MAX_STRING as 128.
That's it?


Re: I need help, please!! - Correlli - 30.09.2009

It should be.


Re: I need help, please!! - ded - 30.09.2009

Well, MAX_STRING is currently defined in dutils.inc as:

pawn Код:
#define MAX_STRING 255




Re: I need help, please!! - Correlli - 30.09.2009

Quote:
Originally Posted by » Pawnst★r «
Well, MAX_STRING is currently defined in dutils.inc as:

pawn Код:
#define MAX_STRING 255
Well, it's 255, but you can change it to 128. You only need more cells if you want to write much stuff to a file.