Little coding questions - For general minor queries 5

spawn the player, set cam pos -> do ..
Reply

Can you use format without any specifiers? For example, I have two strings, string1 and string2:

Код:
new string1[6] = "Hello", string2[6];

format(string2, sizeof(string2), string1);
would that work? or would I have to do:

Код:
format(string2, sizeof(string2), "%s", string1);
Reply

^why not?

edit: woops, actually no. should've proof-read..
Reply

Quote:
Originally Posted by Ada32
View Post
spawn the player, set cam pos -> do ..
Won't work if the player has a big ping or is on his desktop.

@ Derexi
I think there is a strcpy function, not sure (can't check right now). You could also use strcat if you want to make %s%s, string1, string2 into string1.
Reply

i'm getting this error when i include
y_ini or physics in my GM
Code:
y_debug.inc(114) : fatal error 100: cannot read from file: "internal\y_funcinc"
but i have another zombie GM in which it has y_ini but i don't get the error.

here is my includes,
Code:
native WP_Hash(buffer[], len, const str[]);

#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <explosions>
#include <mapandreas>
#include <physics>
#include <YSI\y_ini>
what could've been the problem?
i tried removing either physics or y_ini and tried compiling but it failed. any idea?
Reply

Quote:
Originally Posted by Amads
Посмотреть сообщение
Is 'switch' more effective/faster than 'else ifs'?
Yes, slightly, according to https://sampwiki.blast.hk/wiki/Switch#switch
Reply

why the hell does a ternary operator with an enum crash my compiler?
(IsThis(playerid)) ? ("This") : (sInfo[playerid][pVar])
Reply

Any idea of turning this into a police speed radar
Код:
RadarHud = TextDrawCreate(499.142883, 3.206666, "usebox");
	TextDrawLetterSize(RadarHud, 0.000000, 7.458148);
	TextDrawTextSize(RadarHud, 348.095245, 0.000000);
	TextDrawAlignment(RadarHud, 1);
	TextDrawColor(RadarHud, 0);
	TextDrawUseBox(RadarHud, true);
	TextDrawBoxColor(RadarHud, 102);
	TextDrawSetShadow(RadarHud, 0);
	TextDrawSetOutline(RadarHud, 0);
	TextDrawFont(RadarHud, 0);

	RadarHud = TextDrawCreate(369.523864, 5.546667, "LS-PD SPEED RADAR");
	TextDrawLetterSize(RadarHud, 0.297618, 1.442133);
	TextDrawAlignment(RadarHud, 1);
	TextDrawColor(RadarHud, -1);
	TextDrawSetShadow(RadarHud, 0);
	TextDrawSetOutline(RadarHud, 1);
	TextDrawBackgroundColor(RadarHud, 51);
	TextDrawFont(RadarHud, 1);
	TextDrawSetProportional(RadarHud, 1);

	RadarHud = TextDrawCreate(354.285736, 27.306671, "~n~~r~Speed:         kmph");
	TextDrawLetterSize(RadarHud, 0.164666, 1.194666);
	TextDrawAlignment(RadarHud, 1);
	TextDrawColor(RadarHud, -1);
	TextDrawSetShadow(RadarHud, 0);
	TextDrawSetOutline(RadarHud, 1);
	TextDrawBackgroundColor(RadarHud, 51);
	TextDrawFont(RadarHud, 1);
	TextDrawSetProportional(RadarHud, 1);

	RadarHud = TextDrawCreate(411.047698, 26.880001, "~b~Vehicle Model:");
	TextDrawLetterSize(RadarHud, 0.149428, 1.450667);
	TextDrawAlignment(RadarHud, 1);
	TextDrawColor(RadarHud, -1);
	TextDrawSetShadow(RadarHud, -34);
	TextDrawSetOutline(RadarHud, 0);
	TextDrawBackgroundColor(RadarHud, 51);
	TextDrawFont(RadarHud, 1);
	TextDrawSetProportional(RadarHud, 1);
Reply

I know that there is a relation between kicking delay and the kicked player's ping - i mean if i sent a message, and then delayed the kick as the player's ping (in ms). Will the message get displayed and sent correctly?
Reply

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
I know that there is a relation between kicking delay and the kicked player's ping - i mean if i sent a message, and then delayed the kick as the player's ping (in ms). Will the message get displayed and sent correctly?
It's possible.

But, is more recommended to you, delay the kick in one second. I don't know how many miliseconds the message takes to appear to the client.
Reply

Can someone give me a small kill system of two classes sniper and soldier.Every time a sniper kills the opponent, he gets 1+class point and vice versa with Soldier.
When both kill the opponent 10 times, they get a minigun. Thete should not be big lapses.
its urgent please...also script about the above as longas you think.
Reply

Anyone know the animation where the player runs for a few meters and then jumps, dives down?
Reply

Is there a standard function to put NPCs in Vehicles ? I tried PutPlayerInVehicle, but havent success.

Best regards
Reply

Quote:
Originally Posted by NXGMatze
Посмотреть сообщение
Is there a standard function to put NPCs in Vehicles ? I tried PutPlayerInVehicle, but havent success.

Best regards
https://sampforum.blast.hk/showthread.php?tid=170545

try searching around next time
Reply

What's wrong here? The code works though.

pawn Код:
#define CheckIfUpper(%0) (%0 > 64 && %0 < 94)

if (CheckIfUpper ('A'))
    printf ("It's upper!");
Код:
warning 206: redundant test: constant expression is non-zero
Reply

Quote:
Originally Posted by b3nz
Посмотреть сообщение
What's wrong here? The code works though.

pawn Код:
#define CheckIfUpper(%0) (%0 > 64 && %0 < 94)

if (CheckIfUpper ('A'))
    printf ("It's upper!");
Код:
warning 206: redundant test: constant expression is non-zero
pawn Код:
#define CheckIfUpper(%0) (64 < %0 && %0 < 94)

public OnPlayerConnect(playerid)
{
    new a = 'A';
    if(CheckIfUpper(a)) printf ("It's upper!");
}
Thanks to Vince
Quote:
Originally Posted by Vince
Посмотреть сообщение
You can't write an if-statement without some kind of variable.
Reply

Right, totally forgot this. Thanks!
Reply

I got three dimensional array, where I would like to store spawn information of each team.

In example:
pawn Код:
new const Float:Array[][][] = {{{// X, Y, Z, A}}};
However, when I try to get a random item of a team spawn with
pawn Код:
new rand = random(sizeof(Array[team]));
, it gives me the following error:
Quote:

: error 001: expected token: "]", but found "-identifier-"
: warning 215: expression has no effect
: error 001: expected token: ";", but found "]"
: error 029: invalid expression, assumed zero
: fatal error 107: too many error messages on one line

How to fix this?
Reply

In pawn all dimensions are predefined and have the fixed size, therefore
pawn Код:
new rand = random(sizeof(Array[]));
Reply

so this works
pawn Код:
new blabla[MAX_PLAYERS] = {-1, ...};
how do I do this..
pawn Код:
new blabla[MAX_PLAYERS][MAX_PLAYERS] = {{-1, ...}, ...};
Another thing, whenever I do this the new checkpoint takes the old size, (Is that a native samp bug ? )
Don't want to use a streamer.
pawn Код:
SetPlayerCheckpoint(id, x, y, z, size);
DisablePlayerCheckpoint(i);
SetPlayerCheckpoint(id, x, y, z, newsize);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)